some fixes for rails > 3.1