Rails 4 bugfixes

fixes some issues caused by the switch to Rails 4