Minor improvements

Change-Id: I917c2def6174ce649bcb5fff47a31cd821c90831
diff --git a/token_writer.go b/token_writer.go
index 250d536..ed580ef 100644
--- a/token_writer.go
+++ b/token_writer.go
@@ -54,7 +54,7 @@
 			//   and write to string
 
 			// Accept newline after EOT
-			if flags&NEWLINE_AFTER_EOT != 0 && posC == 0 && buf[0] == '\n' && !init {
+			if posC == 0 && flags&NEWLINE_AFTER_EOT != 0 && buf[0] == '\n' && !init {
 				posC--
 			}
 
@@ -152,7 +152,7 @@
 		// Collect text ends
 	} else {
 		tw.TextEnd = func(_ int) {
-			writer.WriteRune('\n')
+			writer.WriteByte('\n')
 			writer.Flush()
 		}
 	}