fixes MongoEngine/mongoengine #589

Resolving issue #589