maximum and minimum fixes for piecewise distributions