Fixes for rails 4