Fixed issue with query string building