multithreading bug fixed