minor fix in getGroups function