upstream commit be2ba9bd18adaea9f8e466dc05ef77a4c8d3e15e