various fixes for mongoid 4