Fix issue with detection of redirection