Fixed handling of missing directories