handle query string parameters a little more nicely

Patch to ensure query string parameters are handled correctly should the collector API url contain an existing query string.