expect newline at end of segment