Malloc bug fixed