added a fixIndexes method