Conversion from internal format to wire format