Modified to fix redirection errors