Corrected sum method for empty array