Rails 4.x compatibility fixes