few changes to multithreaded