On/Off switch bug fix