Corrected missed line in branch 3006.x when backporting from PR 61620 and 65044