backport #12489