made compatible for Rails 4