fix for threadsafe