Backport of 3489