piecewise bug