Tweaks to lock checking.

See commit 5eeb88c, #16.