Some tweaks to the handling of URLs

Signed-off-by: Thomas Hodgson <thomas.hodgson@gmail.com>