Some url handling fixes