fix the address bug and add lock/unlock
add a comment for branch test