Integrate upstream fixes