[Fix #375] Guard use of package-user-dir

In some rare cases this variable might not be defined