fixed the redirecting issue