Keep a list of account lines with nonzero balances

The balance count was incorrectly including account lines with zero balances.
Keep a filtered list of non-zero account lines and use it where non-zero balances are expected.

Fixes #735.