cherrypicks 1e3a955fc079a052e7f765374d10b9af97403530 5b2da3caf70822fa71baff1c898f65567aecc7f8 ad9c07482871df6f35c3f1b804ed94b1e7351886 8f52bf7d9f4da47dd39eb227a667aa7de1a312b7 491f3f6e448f5cde73a1af8bac22990dffe55106 bb727f4588a5ecdcf750a19bab08db5d6c71653e 3be01ea502addb80f191ff504b4d58b0a0012be9 a0037ee2d8a1a100e1528bcc4fb78fab048957fc 314d210f2b862b90ad67e8f726d7a1af0cb1598c from cc branch