fix a bug in GenFile, output dir not created