fix mongoengine count bugs