fix serious bug in switch control