backport #3507