update the totals before returning the json