Fix #1606 Counts are not correct in the aggregate view