making changes to increase compatibility with rails 4