Fix clipping calculation