fix the error writing.