improved protocol versioning. bugfixes encoding.