Fixed mongoengine compatibility issue