update total_weight & weighted