More sensible behaviour for detecting the default working directory