handle missing trailing newlines