fixing message serialization