Fix GridFS defects. Add unit test for GridFS