strengthened handling of missing directories.