Improve condition while directory not found