#4563 backport