fixed issues to work with rails 3