Fixed portability issues with redirects