Fix infinite recursion when Summing a Piecewise.

Fixes github issue #2597.