fixed bug in calling C function init_threads