fixing index creation bug