update thread safe code