Fix singleton thread-safety