Regression in b52c73008a9d67e9ddbb841872dc15cdd3d6ee01. Thanks Tim Graham for the review. Backport of 540ae68a5cc6339c72375fad9b04dc48f3af4c93 from master.