Repair claimed locked accounts and add self check.

Fixes #420.