Changed flatten to ravel during LUT phase.