fixed switch statement bug