fix calculate sum bug