Fix the crossfold by changing write files logic.