fixed  PostgreSQL error with group by query in the template page
fix on PostgreSQL on heroku server