Fix edge cases broken in 80e320a9