Fixing urlencode issue when running query.