Initialize malloc memory; Fix bug in twkm: use address of a pointer as its value