(*) Fixed possible crash caused by non-exited threads.