Fix a bug in redirect round-tripping

This caused crashes when round-tripping redirects.

Change-Id: If411690e973747fb05ff2b69b210ac2e3e5417cd