added support for 302 redirects