fix error handling in util.math.add_tuples