cleanup trailing newlines