fixed redirection handling