Assign proper groupId.