Fixed determination of filename form URL
Only use $HOME as a fallback to determine users home directory