fix bug on multi-thread thing