bug fix with pulses not being removed if focus away from window when waiting