Fixed a malloc bug