fix some bugs with new Rails 3