make transactions threadsafe