fixing bug with redirects