fix a bug of "ensureIndex"