[#3] Fixes to query string rewriting