further improvements to url handling