added batches.id to group by to make heroku happy