fixing sort totals