add threadsafe option