Fix readonly lock logic.