Fixed a regression in 2f16ff5a6c. Thanks Tim Graham for the review. Backport of 625b8e9295 from master
2f16ff5a6c
625b8e9295