fix buildIndexes