fix error with switch statement