Fix message encoding
Fix type assert