fix TypeError with 'remove_groups=False' and 'groups' defined in user.present

This addresses #4574.