move Piecewise handling

The added test fails in master because symbols are not guaranteed to be available at the place where the piecewise test was done before.