fixing crash when working directory ceases to exist