minor refactor in waiting for timeout