Bug fixed in _rebuildIndex