changed the redirect code