upstream commit 02eed2f817b42590180270dd0059a9e97cf2ced3