Made persistence system thread safe