singleton and multithreading fix