handle timeouts and redirects