switchFlash() modified