bug fix for 'script flush/kill' in multithreading mode