This PR cherry picks b837aa121589930fb1d6b69731a6ecc115e23bbd and 9a37a19498bd5c5f3601dc956ae39824545216d3 into the 3.6 release branch. It is a combined PR as 9a37a19498bd5c5f3601dc956ae39824545216d3 fixes a bug introduced in b837aa121589930fb1d6b69731a6ecc115e23bbd .
This PR cherry picks b837aa121589930fb1d6b69731a6ecc115e23bbd and 9a37a19498bd5c5f3601dc956ae39824545216d3 into the 3.6 release branch. It is a combined PR as 9a37a19498bd5c5f3601dc956ae39824545216d3 fixes a bug introduced in b837aa121589930fb1d6b69731a6ecc115e23bbd .