Fixed issues with Rails 4