fix switch bug