locate the group by code not by id
fix typo with finding a field that did not exist and nil check the group