Changes to avoid unecessary ensure_index calls