clamp values to specific range