Fix SIGSEGV if environment variable is not defined
This branch fixes a SIGSEGV which happens if an undefined environment variable is used in a file name.
This branch fixes a SIGSEGV which happens if an undefined environment variable is used in a file name.