Upstream bug fixes