restored the redirect function.