Backport of 4170