Improved clipping. Fixed clipping and range bugs in MLUT generation.