add basic Piecewise and fix piecewise Sum bug