backport fix for issue #3458 to maintenance