Fixed infinite loop

When relative paths had too many "..", the URL handling code could get
stuck in an infinite loop
Fixed relative path