Call struct_end after struct reads.
Added tests for bugfix.
Merge pull request #3 from layerhq/feature-fix-protocol

Fix protocol (PLAT-215)