Make the singleton thread-safe