Improve redirect behavior.