Port to 2.2 from master-19 branch