Tidyup to prevent redirection loop