modified c_wrapper