Fix issue #112 (copy messages instead of modifying the input msg)
diff --git a/lib/decoding/control_channels_decoder_impl.cc b/lib/decoding/control_channels_decoder_impl.cc
index 3ea3fd9..1d25664 100644
--- a/lib/decoding/control_channels_decoder_impl.cc
+++ b/lib/decoding/control_channels_decoder_impl.cc
@@ -137,13 +137,10 @@
            //send message with header of the first burst
             pmt::pmt_t first_header_plus_burst = pmt::cdr(d_bursts[0]);
             gsmtap_hdr * header = (gsmtap_hdr *)pmt::blob_data(first_header_plus_burst);
-            header->type = GSMTAP_TYPE_UM;
-            
-            int8_t * header_content = (int8_t *)header;
-            
             int8_t header_plus_data[sizeof(gsmtap_hdr)+DATA_BYTES];
-            memcpy(header_plus_data, header_content, sizeof(gsmtap_hdr));
+            memcpy(header_plus_data, header, sizeof(gsmtap_hdr));
             memcpy(header_plus_data+sizeof(gsmtap_hdr), outmsg, DATA_BYTES);
+            ((gsmtap_hdr*)header_plus_data)->type = GSMTAP_TYPE_UM;
             
             pmt::pmt_t msg_binary_blob = pmt::make_blob(header_plus_data,DATA_BYTES+sizeof(gsmtap_hdr));
             pmt::pmt_t msg_out = pmt::cons(pmt::PMT_NIL, msg_binary_blob);
diff --git a/lib/decoding/tch_f_decoder_impl.cc b/lib/decoding/tch_f_decoder_impl.cc
index 467ffe9..cbb1481 100644
--- a/lib/decoding/tch_f_decoder_impl.cc
+++ b/lib/decoding/tch_f_decoder_impl.cc
@@ -155,11 +155,10 @@
 
                     pmt::pmt_t first_header_plus_burst = pmt::cdr(d_bursts[0]);
                     gsmtap_hdr * header = (gsmtap_hdr *)pmt::blob_data(first_header_plus_burst);
-                    header->type = GSMTAP_TYPE_UM;
-                    int8_t * header_content = (int8_t *)header;
                     int8_t header_plus_data[sizeof(gsmtap_hdr)+DATA_BYTES];
-                    memcpy(header_plus_data, header_content, sizeof(gsmtap_hdr));
+                    memcpy(header_plus_data, header, sizeof(gsmtap_hdr));
                     memcpy(header_plus_data+sizeof(gsmtap_hdr), outmsg, DATA_BYTES);
+                    ((gsmtap_hdr*)header_plus_data)->type = GSMTAP_TYPE_UM;
 
                     pmt::pmt_t msg_binary_blob = pmt::make_blob(header_plus_data,DATA_BYTES+sizeof(gsmtap_hdr));
                     pmt::pmt_t msg_out = pmt::cons(pmt::PMT_NIL, msg_binary_blob);
diff --git a/lib/demapping/tch_f_chans_demapper_impl.cc b/lib/demapping/tch_f_chans_demapper_impl.cc
index cc24b9e..a54ed3f 100644
--- a/lib/demapping/tch_f_chans_demapper_impl.cc
+++ b/lib/demapping/tch_f_chans_demapper_impl.cc
@@ -29,6 +29,8 @@
 #include <grgsm/endian.h>
 #include <grgsm/gsmtap.h>
 
+#define BURST_SIZE 148
+
 namespace gr {
   namespace gsm {
 
@@ -80,12 +82,20 @@
         int8_t * burst_bits = (int8_t *)(pmt::blob_data(header_plus_burst))+sizeof(gsmtap_hdr);
 
         if(header->timeslot == d_timeslot){
-            header->sub_type = GSMTAP_CHANNEL_TCH_F;
+            int8_t new_msg[sizeof(gsmtap_hdr)+BURST_SIZE];
+            gsmtap_hdr * new_hdr = (gsmtap_hdr*)new_msg;
+            memcpy(new_msg, header, sizeof(gsmtap_hdr)+BURST_SIZE);
+
+            new_hdr->sub_type = GSMTAP_CHANNEL_TCH_F;
+            if (fn_mod13 == 12)
+                header->sub_type = GSMTAP_CHANNEL_ACCH|GSMTAP_CHANNEL_TCH_F;
+
+            pmt::pmt_t msg_binary_blob = pmt::make_blob(new_msg,sizeof(gsmtap_hdr)+BURST_SIZE);
+            pmt::pmt_t msg_out = pmt::cons(pmt::PMT_NIL, msg_binary_blob);
+
 
             if (fn_mod13 == 12)
             {
-                header->sub_type = GSMTAP_CHANNEL_ACCH|GSMTAP_CHANNEL_TCH_F;
-
                 // position of SACCH burst based on timeslot
                 // see specification gsm 05.02
                 uint32_t index;
@@ -104,7 +114,7 @@
 
                 if (is_sacch)
                 {
-                    d_bursts_sacch[index] = msg;
+                    d_bursts_sacch[index] = msg_out;
                     d_frame_numbers_sacch[index] = frame_nr;
 
                     if (index == 3)
@@ -135,8 +145,8 @@
                 if (fn_mod13 <= 3)
                 {
                     // add to b1 and b3
-                    d_bursts[0][fn_mod13] = msg;
-                    d_bursts[2][fn_mod13 + 4] = msg;
+                    d_bursts[0][fn_mod13] = msg_out;
+                    d_bursts[2][fn_mod13 + 4] = msg_out;
 
                     // set framenumber
                     d_frame_numbers[0][fn_mod13] = frame_nr;
@@ -145,8 +155,8 @@
                 else if (fn_mod13 >= 4 && fn_mod13 <= 7)
                 {
                     // add to b1 and b2
-                    d_bursts[0][fn_mod13] = msg;
-                    d_bursts[1][fn_mod13 - 4] = msg;
+                    d_bursts[0][fn_mod13] = msg_out;
+                    d_bursts[1][fn_mod13 - 4] = msg_out;
 
                     // set framenumber
                     d_frame_numbers[0][fn_mod13] = frame_nr;
@@ -155,8 +165,8 @@
                 else if (fn_mod13 >= 8 && fn_mod13 <= 11)
                 {
                     // add to b2 and b3
-                    d_bursts[1][fn_mod13 - 4] = msg;
-                    d_bursts[2][fn_mod13 - 8] = msg;
+                    d_bursts[1][fn_mod13 - 4] = msg_out;
+                    d_bursts[2][fn_mod13 - 8] = msg_out;
 
                     // set framenumber
                     d_frame_numbers[1][fn_mod13 - 4] = frame_nr;
diff --git a/lib/demapping/universal_ctrl_chans_demapper_impl.cc b/lib/demapping/universal_ctrl_chans_demapper_impl.cc
index 8a6bfb5..c711928 100644
--- a/lib/demapping/universal_ctrl_chans_demapper_impl.cc
+++ b/lib/demapping/universal_ctrl_chans_demapper_impl.cc
@@ -30,6 +30,8 @@
 #include <grgsm/gsmtap.h>
 #include <set>
 
+#define BURST_SIZE 148
+
 namespace gr {
   namespace gsm {
 
@@ -140,7 +142,7 @@
     {
         pmt::pmt_t header_plus_burst = pmt::cdr(msg);
         gsmtap_hdr * header = (gsmtap_hdr *)pmt::blob_data(header_plus_burst);
-
+            
         uint32_t frame_nr = be32toh(header->frame_number);
         uint32_t fn_mod51 = frame_nr % 51;
         uint32_t fn51_start = d_starts_fn_mod51[fn_mod51];
@@ -148,14 +150,19 @@
         uint32_t ch_type = d_channel_types[fn_mod51];
         
         if(header->timeslot==d_timeslot){
-	    header->sub_type = ch_type;
-	    header->sub_slot = d_subslots[fn_mod51 + (51 * (frame_nr % 2))];
+            int8_t new_msg[sizeof(gsmtap_hdr)+BURST_SIZE];
+            gsmtap_hdr * new_hdr = (gsmtap_hdr*)new_msg;
+            memcpy(new_msg, header, sizeof(gsmtap_hdr)+BURST_SIZE);
+            new_hdr->sub_type = ch_type;
+            new_hdr->sub_slot = d_subslots[fn_mod51 + (51 * (frame_nr % 2))];
+            pmt::pmt_t msg_binary_blob = pmt::make_blob(new_msg,sizeof(gsmtap_hdr)+BURST_SIZE);
+            pmt::pmt_t msg_out = pmt::cons(pmt::PMT_NIL, msg_binary_blob);
 	    
             if(fn_mod51>=fn51_start && fn_mod51<=fn51_stop)
             {
                 uint32_t ii = fn_mod51 - fn51_start;
                 d_frame_numbers[ii] = frame_nr;
-                d_bursts[ii] = msg;
+                d_bursts[ii] = msg_out;
             }
             
             if(fn_mod51==fn51_stop)