Fix bug when grouping by host