port of cLock from CM 10.1