Fixes to message unpacking