Continuity of piecewise functions