handle timeouts and errors better