diff --git a/larpix/larpix.py b/larpix/larpix.py
index d4ae36b..a0efae8 100644
--- a/larpix/larpix.py
+++ b/larpix/larpix.py
@@ -1332,7 +1332,7 @@ class PacketCollection(object):
         d['message'] = str(self.message)
         d['read_id'] = 'None' if self.read_id is None else self.read_id
         d['bytestream'] = ('None' if self.bytestream is None else
-                self.bytestream.decode('utf-8'))
+                self.bytestream.decode('raw_unicode_escape'))
         return d
 
     def from_dict(self, d):
@@ -1342,7 +1342,7 @@ class PacketCollection(object):
         '''
         self.message = d['message']
         self.read_id = d['read_id']
-        self.bytestream = d['bytestream'].encode('utf-8')
+        self.bytestream = d['bytestream'].encode('raw_unicode_escape')
         self.parent = None
         self.packets = []
         for p in d['packets']:

diff --git a/test/test_larpix.py b/test/test_larpix.py
index af9e035..8c5165b 100644
--- a/test/test_larpix.py
+++ b/test/test_larpix.py
@@ -189,7 +189,7 @@ def test_controller_save_output(tmpdir):
                     'parent': 'None',
                     'message': 'hi',
                     'read_id': 0,
-                    'bytestream': p.bytes().decode('utf-8')
+                    'bytestream': p.bytes().decode('raw_unicode_escape')
                     }
                 ]
             }
@@ -1699,6 +1699,7 @@ def test_packetcollection_origin():
 
 def test_packetcollection_to_dict():
     packet = Packet()
+    packet.chipid = 246
     packet.packet_type = Packet.TEST_PACKET
     collection = PacketCollection([packet], bytestream=packet.bytes(),
             message='hello')
@@ -1708,11 +1709,11 @@ def test_packetcollection_to_dict():
             'parent': 'None',
             'message': 'hello',
             'read_id': 'None',
-            'bytestream': packet.bytes().decode('utf-8'),
+            'bytestream': packet.bytes().decode('raw_unicode_escape'),
             'packets': [{
                 'bits': packet.bits.bin,
                 'type': 'test',
-                'chipid': 0,
+                'chipid': packet.chipid,
                 'parity': 0,
                 'valid_parity': True,
                 'counter': 0

Some bytestreams don't parse well to JSON in Python 2 (PacketCollection.to_dict)
``UnicodeDecodeError: 'utf8' codec can't decode byte 0xd8 in position 1: invalid continuation byte``. Indeed byte ``b"\xd8"`` is in position 1. I think I'll need to insert some Python version logic into the to_dict and from_dict methods.
test/test_larpix.py::test_packetcollection_to_dict
test/test_larpix.py::test_FakeSerialPort_write test/test_larpix.py::test_FakeSerialPort_read test/test_larpix.py::test_FakeSerialPort_read_multi test/test_larpix.py::test_chip_str test/test_larpix.py::test_chip_get_configuration_packets test/test_larpix.py::test_chip_sync_configuration test/test_larpix.py::test_chip_export_reads test/test_larpix.py::test_chip_export_reads_no_new_reads test/test_larpix.py::test_chip_export_reads_all test/test_larpix.py::test_controller_save_output test/test_larpix.py::test_controller_load test/test_larpix.py::test_packet_bits_bytes test/test_larpix.py::test_packet_init_default test/test_larpix.py::test_packet_init_bytestream test/test_larpix.py::test_packet_bytes_zeros test/test_larpix.py::test_packet_bytes_custom test/test_larpix.py::test_packet_bytes_properties test/test_larpix.py::test_packet_export_test test/test_larpix.py::test_packet_export_data test/test_larpix.py::test_packet_export_config_read test/test_larpix.py::test_packet_export_config_write test/test_larpix.py::test_packet_set_packet_type test/test_larpix.py::test_packet_get_packet_type test/test_larpix.py::test_packet_set_chipid test/test_larpix.py::test_packet_get_chipid test/test_larpix.py::test_packet_set_parity_bit_value test/test_larpix.py::test_packet_get_parity_bit_value test/test_larpix.py::test_packet_compute_parity test/test_larpix.py::test_packet_assign_parity test/test_larpix.py::test_packet_has_valid_parity test/test_larpix.py::test_packet_set_channel_id test/test_larpix.py::test_packet_get_channel_id test/test_larpix.py::test_packet_set_timestamp test/test_larpix.py::test_packet_get_timestamp test/test_larpix.py::test_packet_set_dataword test/test_larpix.py::test_packet_get_dataword test/test_larpix.py::test_packet_get_dataword_ADC_bug test/test_larpix.py::test_packet_set_fifo_half_flag test/test_larpix.py::test_packet_get_fifo_half_flag test/test_larpix.py::test_packet_set_fifo_full_flag test/test_larpix.py::test_packet_get_fifo_full_flag test/test_larpix.py::test_packet_set_register_address test/test_larpix.py::test_packet_get_register_address test/test_larpix.py::test_packet_set_register_data test/test_larpix.py::test_packet_get_register_data test/test_larpix.py::test_packet_set_test_counter test/test_larpix.py::test_packet_get_test_counter test/test_larpix.py::test_configuration_get_nondefault_registers test/test_larpix.py::test_configuration_get_nondefault_registers_array test/test_larpix.py::test_configuration_get_nondefault_registers_many_changes test/test_larpix.py::test_configuration_set_pixel_trim_thresholds test/test_larpix.py::test_configuration_get_pixel_trim_thresholds test/test_larpix.py::test_configuration_set_global_threshold test/test_larpix.py::test_configuration_get_global_threshold test/test_larpix.py::test_configuration_set_csa_gain test/test_larpix.py::test_configuration_get_csa_gain test/test_larpix.py::test_configuration_set_csa_bypass test/test_larpix.py::test_configuration_get_csa_bypass test/test_larpix.py::test_configuration_set_internal_bypass test/test_larpix.py::test_configuration_get_internal_bypass test/test_larpix.py::test_configuration_set_csa_bypass_select test/test_larpix.py::test_configuration_get_csa_bypass_select test/test_larpix.py::test_configuration_set_csa_monitor_select test/test_larpix.py::test_configuration_get_csa_monitor_select test/test_larpix.py::test_configuration_set_csa_testpulse_enable test/test_larpix.py::test_configuration_get_csa_testpulse_enable test/test_larpix.py::test_configuration_set_csa_testpulse_dac_amplitude test/test_larpix.py::test_configuration_get_csa_testpulse_dac_amplitude test/test_larpix.py::test_configuration_set_test_mode test/test_larpix.py::test_configuration_get_test_mode test/test_larpix.py::test_configuration_set_cross_trigger_mode test/test_larpix.py::test_configuration_get_cross_trigger_mode test/test_larpix.py::test_configuration_set_periodic_reset test/test_larpix.py::test_configuration_get_periodic_reset test/test_larpix.py::test_configuration_set_fifo_diagnostic test/test_larpix.py::test_configuration_get_fifo_diagnostic test/test_larpix.py::test_configuration_set_test_burst_length test/test_larpix.py::test_configuration_get_test_burst_length test/test_larpix.py::test_configuration_set_adc_burst_length test/test_larpix.py::test_configuration_get_adc_burst_length test/test_larpix.py::test_configuration_set_channel_mask test/test_larpix.py::test_configuration_get_channel_mask test/test_larpix.py::test_configuration_set_external_trigger_mask test/test_larpix.py::test_configuration_get_external_trigger_mask test/test_larpix.py::test_configuration_set_reset_cycles test/test_larpix.py::test_configuration_get_reset_cycles test/test_larpix.py::test_configuration_disable_channels test/test_larpix.py::test_configuration_disable_channels_default test/test_larpix.py::test_configuration_enable_channels test/test_larpix.py::test_configuration_enable_channels_default test/test_larpix.py::test_configuration_enable_external_trigger test/test_larpix.py::test_configuration_enable_external_trigger_default test/test_larpix.py::test_configuration_disable_external_trigger test/test_larpix.py::test_configuration_enable_testpulse test/test_larpix.py::test_configuration_enable_testpulse_default test/test_larpix.py::test_configuration_disable_testpulse test/test_larpix.py::test_configuration_disable_testpulse_default test/test_larpix.py::test_configuration_enable_analog_monitor test/test_larpix.py::test_configuration_disable_analog_monitor test/test_larpix.py::test_configuration_trim_threshold_data test/test_larpix.py::test_configuration_global_threshold_data test/test_larpix.py::test_configuration_csa_gain_and_bypasses_data test/test_larpix.py::test_configuration_csa_bypass_select_data test/test_larpix.py::test_configuration_csa_monitor_select_data test/test_larpix.py::test_configuration_csa_testpulse_enable_data test/test_larpix.py::test_configuration_csa_testpulse_dac_amplitude_data test/test_larpix.py::test_configuration_test_mode_xtrig_reset_diag_data test/test_larpix.py::test_configuration_sample_cycles_data test/test_larpix.py::test_configuration_test_burst_length_data test/test_larpix.py::test_configuration_adc_burst_length_data test/test_larpix.py::test_configuration_channel_mask_data test/test_larpix.py::test_configuration_external_trigger_mask_data test/test_larpix.py::test_configuration_reset_cycles_data test/test_larpix.py::test_configuration_to_dict test/test_larpix.py::test_configuration_from_dict test/test_larpix.py::test_configuration_write test/test_larpix.py::test_configuration_write_force test/test_larpix.py::test_configuration_read_absolute test/test_larpix.py::test_configuration_read_default test/test_larpix.py::test_configuration_read_local test/test_larpix.py::test_configuration_from_dict_reg_pixel_trim test/test_larpix.py::test_configuration_from_dict_reg_global_threshold test/test_larpix.py::test_configuration_from_dict_reg_csa_gain test/test_larpix.py::test_configuration_from_dict_reg_csa_bypass test/test_larpix.py::test_configuration_from_dict_reg_internal_bypass test/test_larpix.py::test_configuration_from_dict_reg_csa_bypass_select test/test_larpix.py::test_configuration_from_dict_reg_csa_monitor_select test/test_larpix.py::test_configuration_from_dict_reg_csa_testpulse_enable test/test_larpix.py::test_configuration_from_dict_reg_csa_testpulse_dac_amplitude test/test_larpix.py::test_configuration_from_dict_reg_test_mode test/test_larpix.py::test_configuration_from_dict_reg_cross_trigger_mode test/test_larpix.py::test_configuration_from_dict_reg_periodic_reset test/test_larpix.py::test_configuration_from_dict_reg_fifo_diagnostic test/test_larpix.py::test_configuration_from_dict_reg_sample_cycles test/test_larpix.py::test_configuration_from_dict_reg_test_burst_length test/test_larpix.py::test_configuration_from_dict_reg_adc_burst_length test/test_larpix.py::test_configuration_from_dict_reg_channel_mask test/test_larpix.py::test_configuration_from_dict_reg_external_trigger_mask test/test_larpix.py::test_configuration_from_dict_reg_reset_cycles test/test_larpix.py::test_controller_init_chips test/test_larpix.py::test_controller_get_chip test/test_larpix.py::test_controller_get_chip_all_chips test/test_larpix.py::test_controller_serial_read_mock test/test_larpix.py::test_controller_serial_write_mock test/test_larpix.py::test_controller_serial_write_read_mock test/test_larpix.py::test_packetcollection_getitem_int test/test_larpix.py::test_packetcollection_getitem_int_bits test/test_larpix.py::test_packetcollection_getitem_slice test/test_larpix.py::test_packetcollection_getitem_slice_bits test/test_larpix.py::test_packetcollection_origin test/test_larpix.py::test_packetcollection_from_dict