change the way redirects happen to make it more robust (I think)