change sum API,fix sum bug