PLD: use flatten to get accurate count