change the protocol to make consistent with c++ version