some bugs
add lock