propertly encode query urls