partial backport 3569