fix for loop of groups