fixed client malloc issues