fix write file.