removed memory leaks on mongodb wrapper