Added checks before trying to add a user to a local group