fixed a switch bug