bug fixed : multi local functions in one thread make script not work properly