make redirect a little smarter