Added locking.
Merge branch 'test' into dev