upstream commit c0319acf0c185c90d09234d9921085c89176239d