This turns out not to be the main problem exposed in SPR-9498 but it seems like a sensible addition anyway.