diff --git a/app/models/reshare.rb b/app/models/reshare.rb
index 869d73351ae5d85e45d11726c2336bfe99decb58..7e8fac45b596acceb29b6e949311e4a2d5289f01 100644
--- a/app/models/reshare.rb
+++ b/app/models/reshare.rb
@@ -18,7 +18,7 @@ class Reshare < Post
   end
 
   after_commit :on => :create do
-    self.root.update_reshares_counter
+    self.root.update_reshares_counter if self.root.present?
   end
 
   after_destroy do
diff --git a/config/application.rb b/config/application.rb
index b84576c79beffaa181996865215b9d20d993910c..4d579a5423b572c7192f938809452f41dd4387dd 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -89,5 +89,8 @@ module Diaspora
       g.template_engine :haml
       g.test_framework  :rspec
     end
+
+    # Will be default with Rails 5
+    config.active_record.raise_in_transactional_callbacks = true
   end
 end