Better handling of light flicker and count increase/decrease when toggling modes