Fix bug when redirecting.