Fixed code so that if group doesnt exist, then there is an error