some changes to compile successfully Wqwith lut malloc