Forward port of #5751 to 7_2_X

Forward port of #5751 to 7_2_X