Thread safety

Change-Id: Ia80bb56795cbad4fb3ba567998009f4b703447a4