modify malloc for alloc memory, which cause the units is not right