Some minor fixes for rails 4 upgrade