Fixed gridfs file storage & added tests