Fix index problems