fix edge case issue with query strings

this should fix #7