modify multi thread handling