Test and fix errors with element sums