fixed endless loop problem for timeouts