preserve trailing newline if there is one