clamp values to min/max