fix bug: totals were not adding up correctly