Error checked the sum method