changed some lines for rails 3.0.1 and ruby 1.9.2