fixed multi threading issue