Added a 2 second timeout when checking whether a directory exists.