fix append newline bug