Fix build error when output directory is missing