updated thread_safe