Fixed the redirect code