add thread-safe code