removing trailing newlines