add threads and thread_id to script_init