The recent fix for issue 9712 has a flaw, which is fixed here...

I branched off from that recent fix for historic clarity.