implemented fetch_output! in C