try to fix some thread safe issue