add redirection error checking