cherry-unpicked source compatibility in main branch back to 1.7