fix for rewrite and rails4