Checks and compilation fixes

Some checks in the protocol decoding
Fixed prototypes