Fix clipping issues

This fixes #116.