Possibly fixed multithreading issue