fixed an infinite loop bug in the Group class