update rpc, fix a few bugs