Fix for generating bad lut.