add handlePrepareReply, fix some bugs