Restrict serialization to valid packets.