Add fixes for Rails 3