More tests for totals and subtotals, with fixes.