This fixes a regression introduced by 2a31d00933. Thanks tony-zhu for the report. Backport of f0bb3c98cc from master.