bug fixes in redirecting