fix total_sum problem