Fix query string construction