multithreading issues fixed