add lock logic