fixes for rails/ruby compatibility. Rails4/ruby2