improve file write