refactor error msg
send done when file eof