fix bugs with protocol definition