ActiveRecord 4 bug fix