Fixes for imports and thread locking

Change-Id: I93f4ceec722af9cc6d4d55a97448622e1835dada