handle redirects a bit better