Fixes query strings with one param

The logic didn't seem quite right for accounting for the url param in the query string that occurs depending on your web server rewrite rules.