Fix redirection loop issue