remove trailing newline code