add code in rpc and pass lock tests