(fix) migrate to c from c++