NameError: global name 'group' is not defined

Fix a NameError