Fixed malloc issue