Updated to have same fixes as 1.7.2 branch