fix toggle switch bug