some changes for rails4 compatibility