Solve the thread_safe version