implemented safe, bulk writes in gridfs