Fix rails4 issues