diff --git a/app/assets/javascripts/profile.js.coffee b/app/assets/javascripts/profile.js.coffee
index d13c6007819847b080e9be15d624ba2cd28c35cb..69d590a7533128dda290369837c05309721493d2 100644
--- a/app/assets/javascripts/profile.js.coffee
+++ b/app/assets/javascripts/profile.js.coffee
@@ -53,7 +53,7 @@ class @Profile
     $avatarInput.on "change", ->
       form = $(this).closest("form")
       filename = $(this).val().replace(/^.*[\\\/]/, '')
-      $filename.text(filename)
+      $filename.data('label', $filename.text()).text(filename)
 
       reader = new FileReader
 
diff --git a/app/models/user.rb b/app/models/user.rb
index 1b0c82f45c4a409b597f26a37549645778e650dd..37285c2a9d4adbb33c17df1b8dc620c41bf4143d 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -99,9 +99,7 @@ class User < ActiveRecord::Base
   attr_accessor :login
 
   # Virtual attributes to define avatar cropping
-  [:avatar_crop_x, :avatar_crop_y, :avatar_crop_size].each do |field|
-    attr_accessor field
-  end
+  attr_accessor :avatar_crop_x, :avatar_crop_y, :avatar_crop_size
 
   #
   # Relations
@@ -169,7 +167,7 @@ class User < ActiveRecord::Base
   validates :avatar, file_size: { maximum: 200.kilobytes.to_i }
 
   [:avatar_crop_x, :avatar_crop_y, :avatar_crop_size].each do |field|
-    validates field, numericality: { only_integer: true }, allow_blank: true
+    validates field, numericality: { only_integer: true }, presence: true, if: ->(user) { user.avatar_changed? }
   end
 
   before_validation :generate_password, on: :create
diff --git a/app/uploaders/avatar_uploader.rb b/app/uploaders/avatar_uploader.rb
index 60ee80cf0024e0b4201c028ce92fd8309f0333cd..c8d9ab072e85ec6f61e9910dbc3d2f33979dd488 100644
--- a/app/uploaders/avatar_uploader.rb
+++ b/app/uploaders/avatar_uploader.rb
@@ -10,15 +10,8 @@ class AvatarUploader < CarrierWave::Uploader::Base
 
   process :cropper
 
-  def is_integer? string
-    true if Integer(string) rescue false
-  end
-
   def cropper
-    is_compliant = model.kind_of?(User) && is_integer?(model.avatar_crop_size)
-    is_compliant = is_compliant && is_integer?(model.avatar_crop_x) && is_integer?(model.avatar_crop_y)
-
-    if is_compliant
+    if model.kind_of?(User) && model.valid?
       manipulate! do |img|
         img.crop "#{model.avatar_crop_size}x#{model.avatar_crop_size}+#{model.avatar_crop_x}+#{model.avatar_crop_y}"
       end
diff --git a/app/views/profiles/show.html.haml b/app/views/profiles/show.html.haml
index 6686c037b60e08c33ca30fa63dcbdbf54234247c..04f738c2759b5ac6eb2be25580cc472ee3bd2b91 100644
--- a/app/views/profiles/show.html.haml
+++ b/app/views/profiles/show.html.haml
@@ -88,7 +88,7 @@
               %i.fa.fa-paperclip
               %span Choose File ...
             &nbsp;
-            %span.file_name.js-avatar-filename{:'data-label' => 'File name...'} File name...
+            %span.file_name.js-avatar-filename File name...
             = f.file_field :avatar, class: "js-user-avatar-input hidden"
             = f.hidden_field :avatar_crop_x
             = f.hidden_field :avatar_crop_y
@@ -107,7 +107,7 @@
   .modal-dialog
     .modal-content
       .modal-header
-        %button.close{:type => "button", :'data-dismiss' => "modal"}
+        %button.close{type: 'button', data: {dismiss: 'modal'}}
           %span
             &times;
         %h4.modal-title