fixed some index problems