Fix to work with redirects