Fixes for Rails 4