gradientSum is max not sum