fix read&write not creating newline