some fixes in redirecting