removed some memory leaks on mongodb wrapper