Improve capability lock logic.