added check for not @obj.nil? to @obj.errors.any?