fix mongoid 4 compatibility