fix trailing newline bug