More fixes for calculating balances.