fixing index problem