switch bug fix