Python 3 fixes and pymongo test