try to add thread safe but doesn't work