fixed a typo. write-nfile to write-file