Upstream merges and fixes