fixing timing issue of switch1