These were discovered while testing !986 (merged), but I think the fixes are generic enough to land separately.