fix a bug with big file write but it is imperfect