some fixes, works with rails 4/mongoid 4