Don't rely on count() working on lists

Rationale is exactly the same as for d6930f966499bd4bf76ccfeee7f5dfdc60a3df93