refs #895, refs #896, fix bugs in dropPartition and ensureIndex