fixed the problem of redirecting