fixed error with sums