handle timeouts properly