fixing loop on getGroup check