Fixed errors regarding switch statements