fixed the issues with redirecting