Fixes for pymongo 2.4.1 and django 1.4.3