merged from upstream 3