misc code fixes for rails 3.2