Properly implemented tryLock functions