Changes for compatibility with Mongoid 4.0.0