add autoflush in BufWriter