Fix preserving URI query string. Closes gh-534. Still no tests.

absolutely not sure how to test this