remove bug in resize buf
should update to char*
remove bug in string cpy