fix an infinite loop

This occurs when the number of tests involved in a failing group is >2 but is constant.