Manually Merged from upstream.