merged from upstream