Fixing 'non-integer constant in ORDER BY' error for Heroku.