small changes in handling mongodb