Multithreading partially working