merged from upstream 4