fixed a bug with MongoWriter