Fix threadsafe