fixed bug in code example of lock()