raising errors if sum is wrong