Thanks Mark Tranchant for the report and Tim Graham for the test and review. Backport of a9e29fae from master