Fixing type check before converting mongoid