fix totals calc