Fix for building query url