Fixing concurrency issude with singleton initialization