Fix doesDirectoryExist; fixes trac #1490