Fix query URI building.