Fixed the redirect handling with trace_redirects.