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