fixed malloc issue