Fix ensureIndex.