fixing multithread