fix for mongoid issue #527