fix sum bugs