Bugfixes on the protocol