1.5 branch cherry pick from master PR 1395, 1396