Fixed the timeout/flush loop-check logic to work properly with