Put fix for group by in loops in, per kevin.