Critical fixes in db module and mongodb drivers