Made two methods threadsafe.
Merge commit 'bb70d60dccbbdce423cab3a3686592a254010541'