Added init once saftly logic.
Fixed mutex deadlock.