handle timeouts and errors more gracefully