remove dependence on ffi