fix mode bug in switch statement