Add the missing parts of the previous cherry-pick.