fixing the blinking of toggle control