diff --git a/openair1/PHY/LTE_TRANSPORT/dci_tools_common.c b/openair1/PHY/LTE_TRANSPORT/dci_tools_common.c
index 6cb2ae47386c88e4234e6d157c5cc805223ad8f9..9a1aa279b0101c428186955d3c07629c01e13215 100644
--- a/openair1/PHY/LTE_TRANSPORT/dci_tools_common.c
+++ b/openair1/PHY/LTE_TRANSPORT/dci_tools_common.c
@@ -1056,13 +1056,9 @@ uint32_t pdcch_alloc2ul_frame(LTE_DL_FRAME_PARMS *frame_parms,uint32_t frame, ui
   uint32_t ul_frame;
 
   if ((frame_parms->frame_type == TDD) &&
-      (frame_parms->tdd_config == 1)) {
-    if ((n==1)||(n==6)||(n==4)||(n==9)) { // tdd_config 0,1 SF 1,5
+      (frame_parms->tdd_config == 1) &&
+      ((n==1)||(n==6)||(n==4)||(n==9))) { // tdd_config 0,1 SF 1,5
       ul_frame = (frame + (n < 5 ? 0 : 1));
-    } else {
-    LOG_E(PHY, "frame %d subframe %d: PUSCH frame = ?\n", frame, n);
-    ul_frame = 0;
-    }
   } else if ((frame_parms->frame_type == TDD) &&
            (frame_parms->tdd_config == 6) &&
            ((n==0)||(n==1)||(n==5)||(n==6)))
diff --git a/openair1/SCHED/ru_procedures.c b/openair1/SCHED/ru_procedures.c
index 17b12e762227fa470b061dfdec998e9700e901fe..6d0ceedf4f1dd31e91df13124083e9c680ae3d84 100644
--- a/openair1/SCHED/ru_procedures.c
+++ b/openair1/SCHED/ru_procedures.c
@@ -343,25 +343,27 @@ void feptx_ofdm(RU_t *ru) {
        }
      }
       */
-     if ((fp->frame_type == TDD) && 
-         ((fp->tdd_config==0) ||
-	   (fp->tdd_config==1) ||
-	   (fp->tdd_config==2) ||
-	   (fp->tdd_config==6)) && 
-	     ((subframe==0) || (subframe==5))) {
-       // turn on tx switch N_TA_offset before
-       //LOG_D(HW,"subframe %d, time to switch to tx (N_TA_offset %d, slot_offset %d) \n",subframe,ru->N_TA_offset,slot_offset);
-       for (i=0; i<ru->N_TA_offset; i++) {
-         tx_offset = (int)slot_offset+i-ru->N_TA_offset/2;
-         if (tx_offset<0)
-           tx_offset += LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*fp->samples_per_tti;
-	 
-         if (tx_offset>=(LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*fp->samples_per_tti))
-           tx_offset -= LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*fp->samples_per_tti;
-	 
-         ru->common.txdata[aa][tx_offset] = 0x00000000;
-       }
-     }
+
+//     if ((fp->frame_type == TDD) &&
+//         ((fp->tdd_config==0) ||
+//	   (fp->tdd_config==1) ||
+//	   (fp->tdd_config==2) ||
+//	   (fp->tdd_config==6)) &&
+//	     ((subframe==0) || (subframe==5))) {
+//       // turn on tx switch N_TA_offset before
+//       //LOG_D(HW,"subframe %d, time to switch to tx (N_TA_offset %d, slot_offset %d) \n",subframe,ru->N_TA_offset,slot_offset);
+//       for (i=0; i<ru->N_TA_offset; i++) {
+//         tx_offset = (int)slot_offset+i-ru->N_TA_offset/2;
+//         if (tx_offset<0)
+//           tx_offset += LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*fp->samples_per_tti;
+//
+//         if (tx_offset>=(LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*fp->samples_per_tti))
+//           tx_offset -= LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*fp->samples_per_tti;
+//
+//         ru->common.txdata[aa][tx_offset] = 0x00000000;
+//       }
+//     }
+
      stop_meas(&ru->ofdm_mod_stats);
      LOG_D(PHY,"feptx_ofdm (TXPATH): frame %d, subframe %d: txp (time %p) %d dB, txp (freq) %d dB\n",
 	   ru->proc.frame_tx,subframe,txdata,dB_fixed(signal_energy((int32_t*)txdata,fp->samples_per_tti)),
diff --git a/openair2/ENB_APP/flexran_agent_defs.h b/openair2/ENB_APP/flexran_agent_defs.h
index aa71dd33fab750e933a0d86ab1b1ab43f28c5a43..57265b38b74a654a60e57411125cf94aeda3a425 100644
--- a/openair2/ENB_APP/flexran_agent_defs.h
+++ b/openair2/ENB_APP/flexran_agent_defs.h
@@ -102,7 +102,7 @@ typedef enum {
 } ran_name_t;
 
 typedef uint8_t xid_t;  
-typedef uint8_t mid_t;  // module or enb id 
+typedef uint16_t mid_t;  // module or enb id 
 typedef uint8_t lcid_t;
 typedef int32_t  err_code_t; 
 
diff --git a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c
index 336bfc5e6f10c47b8dbce66af75552caffcec5b3..7c84b15bee5a509bad3c00ac1d92b6ebbf63b11c 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c
@@ -3561,39 +3561,43 @@ extract_harq(module_id_t mod_idP, int CC_idP, int UE_id,
 	  frame_tx = subframeP < 4 ? frameP -1 : frameP;
 	harq_pid = frame_subframe2_dl_harq_pid(cc->tdd_Config,frame_tx,subframe_tx);
         RA_t *ra = &RC.mac[mod_idP]->common_channels[CC_idP].ra[0];
-	
-	if(num_ack_nak==1){
-	  if(harq_indication_tdd->harq_data[0].bundling.value_0==1){ //ack
-	    sched_ctl->round[CC_idP][harq_pid] = 8; // release HARQ process
-	    sched_ctl->tbcnt[CC_idP][harq_pid] = 0;
-	    LOG_D(MAC,"frame %d subframe %d Acking (%d,%d) harq_pid %d round %d\n",frameP,subframeP,frame_tx,subframe_tx,harq_pid,sched_ctl->round[CC_idP][harq_pid]);
-	  }else{ //nack
-	    if( sched_ctl->round[CC_idP][harq_pid]<8) sched_ctl->round[CC_idP][harq_pid]++;
-	    LOG_D(MAC,"frame %d subframe %d Nacking (%d,%d) harq_pid %d round %d\n",frameP,subframeP,frame_tx,subframe_tx,harq_pid,sched_ctl->round[CC_idP][harq_pid]);
-	    if(sched_ctl->round[CC_idP][harq_pid] == 8){
-	      for (uint8_t ra_i = 0; ra_i < NB_RA_PROC_MAX; ra_i++) {
-		if((ra[ra_i].rnti == rnti) && (ra[ra_i].state == WAITMSG4ACK)){
-		  //Msg NACK num to MAC ,remove UE
-		  // add UE info to freeList
-		  LOG_I(MAC, "put UE %x into freeList\n", rnti);
-		  put_UE_in_freelist(mod_idP, rnti, 1);
-		}
-	      }
-	    }
-	  }
-	}
-	for (uint8_t ra_i = 0; ra_i < NB_RA_PROC_MAX; ra_i++) {
-	  if ((ra[ra_i].rnti == rnti) && (ra[ra_i].state == MSGCRNTI_ACK) && (ra[ra_i].crnti_harq_pid == harq_pid)) {
-	    LOG_D(MAC,"CRNTI Reconfiguration: ACK %d rnti %x round %d frame %d subframe %d \n",harq_indication_tdd->harq_data[0].bundling.value_0,rnti,sched_ctl->round[CC_idP][harq_pid],frameP,subframeP);
-	    if(num_ack_nak == 1 && harq_indication_tdd->harq_data[0].bundling.value_0 == 1) {
-	      cancel_ra_proc(mod_idP, CC_idP, frameP, ra[ra_i].rnti);
-	    }else{
-	      if(sched_ctl->round[CC_idP][harq_pid] == 7){
-		cancel_ra_proc(mod_idP, CC_idP, frameP, ra[ra_i].rnti);
-	      }
-	    }
-	    break;
-	  }
+
+       if(num_ack_nak==1){
+         if(harq_indication_tdd->harq_data[0].bundling.value_0==1){ //ack
+           sched_ctl->round[CC_idP][harq_pid] = 8; // release HARQ process
+           sched_ctl->tbcnt[CC_idP][harq_pid] = 0;
+           LOG_D(MAC,"frame %d subframe %d Acking (%d,%d) harq_pid %d round %d\n",frameP,subframeP,frame_tx,subframe_tx,harq_pid,sched_ctl->round[CC_idP][harq_pid]);
+         }else{ //nack
+	   if( sched_ctl->round[CC_idP][harq_pid]<8) sched_ctl->round[CC_idP][harq_pid]++;
+           if (sched_ctl->round[CC_idP][harq_pid] == 4) {
+             sched_ctl->round[CC_idP][harq_pid] = 8;     // release HARQ process
+             sched_ctl->tbcnt[CC_idP][harq_pid] = 0;
+           }
+           LOG_D(MAC,"frame %d subframe %d Nacking (%d,%d) harq_pid %d round %d\n",frameP,subframeP,frame_tx,subframe_tx,harq_pid,sched_ctl->round[CC_idP][harq_pid]);
+      if(sched_ctl->round[CC_idP][harq_pid] == 8){
+       for (uint8_t ra_i = 0; ra_i < NB_RA_PROC_MAX; ra_i++) {
+        if((ra[ra_i].rnti == rnti) && (ra[ra_i].state == WAITMSG4ACK)){
+         //Msg NACK num to MAC ,remove UE
+         // add UE info to freeList
+         LOG_I(RRC, "put UE %x into freeList\n", rnti);
+         put_UE_in_freelist(mod_idP, rnti, 1);
+        }
+       }
+      }
+         }
+        }
+        for (uint8_t ra_i = 0; ra_i < NB_RA_PROC_MAX; ra_i++) {
+        if ((ra[ra_i].rnti == rnti) && (ra[ra_i].state == MSGCRNTI_ACK) && (ra[ra_i].crnti_harq_pid == harq_pid)) {
+         LOG_D(MAC,"CRNTI Reconfiguration: ACK %d rnti %x round %d frame %d subframe %d \n",harq_indication_tdd->harq_data[0].bundling.value_0,rnti,sched_ctl->round[CC_idP][harq_pid],frameP,subframeP);
+         if(num_ack_nak == 1 && harq_indication_tdd->harq_data[0].bundling.value_0 == 1) {
+          cancel_ra_proc(mod_idP, CC_idP, frameP, ra[ra_i].rnti);
+         }else{
+          if(sched_ctl->round[CC_idP][harq_pid] == 7){
+           cancel_ra_proc(mod_idP, CC_idP, frameP, ra[ra_i].rnti);
+          }
+         }
+         break;
+        }
        }
       }
       break;
@@ -4481,18 +4485,11 @@ static int nack_or_dtx_reported(
   int i;
 
   if (cc->tdd_Config) {
-    nfapi_harq_indication_tdd_rel13_t *harq_indication_tdd = &harq_pdu->harq_indication_tdd_rel13;
-    // AssertFatal(0==1, "TDD to be done. FAPI structures (see nfapi_harq_indication_tdd_rel13_t) are not clean. To be cleaned as well?\n");
-    AssertFatal(harq_indication_tdd->number_of_ack_nack==1,"number of ack/nak %d != 1\n",harq_indication_tdd->number_of_ack_nack); 
-    switch (harq_indication_tdd->mode) {
-    case 0: // Format 1a/b bundling
-      if (harq_indication_tdd->harq_data[0].bundling.value_0 == 1) return 1;
-      return 0;
-      break;
-    default:
-      AssertFatal(1==0,"harq_indication_tdd type is not bundling\n");
-      break;
-    }
+    nfapi_harq_indication_tdd_rel13_t *hi = &harq_pdu->harq_indication_tdd_rel13;
+    for (i = 0; i < hi->number_of_ack_nack; hi++)
+      if (hi->harq_data[0].bundling.value_0 != 1) //only bundling is used for tdd for now
+        return 1;
+    return 0;
   } else {
     nfapi_harq_indication_fdd_rel13_t *hi = &harq_pdu->harq_indication_fdd_rel13;
     for (i = 0; i < hi->number_of_ack_nack; hi++)
diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c
index 33422c1fea64ab5515e9a9a03d506cc37f0d51f2..c6ce37c98d4796e1782cbdfa1b0f3452109d3416 100644
--- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c
+++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c
@@ -860,7 +860,7 @@ pdcp_data_ind(
 
 void pdcp_update_stats(const protocol_ctxt_t* const  ctxt_pP){
 
-  uint8_t            pdcp_uid = 0;
+  uint16_t           pdcp_uid = 0;
   uint8_t            rb_id     = 0;
   
  // these stats are measured for both eNB and UE on per seond basis 
diff --git a/openair2/RRC/LTE/rrc_eNB_S1AP.c b/openair2/RRC/LTE/rrc_eNB_S1AP.c
index 032687719926dd0849995b4d2bfcd813815e5818..c0c143fc3ad6858928d40824b0e57520fe4dcef0 100644
--- a/openair2/RRC/LTE/rrc_eNB_S1AP.c
+++ b/openair2/RRC/LTE/rrc_eNB_S1AP.c
@@ -1940,7 +1940,7 @@ int rrc_eNB_process_PAGING_IND(MessageDef *msg_p, const char *msg_name, instance
 
               /* insert data to UE_PF_PO or update data in UE_PF_PO */
               pthread_mutex_lock(&ue_pf_po_mutex);
-              uint8_t i = 0;
+              uint16_t i = 0;
               for (i = 0; i < MAX_MOBILES_PER_ENB; i++) {
                 if ((UE_PF_PO[CC_id][i].enable_flag == TRUE && UE_PF_PO[CC_id][i].ue_index_value == (uint16_t)(S1AP_PAGING_IND(msg_p).ue_index_value))
                     || (UE_PF_PO[CC_id][i].enable_flag != TRUE)) {
diff --git a/openair2/UTIL/LOG/log.c b/openair2/UTIL/LOG/log.c
index 600135d2fc60b9218df25999441a1ae4041a9ce2..d36e16980ce0d99822658cb7614b3b82562cb6a5 100644
--- a/openair2/UTIL/LOG/log.c
+++ b/openair2/UTIL/LOG/log.c
@@ -309,7 +309,7 @@ void  log_getconfig(log_t *g_log) {
           logparams_logfile[i].optname[j] = tolower(logparams_logfile[i].optname[j]);
 /* */
     logparams_level[i].defstrval     = gloglevel;
-    logparams_verbosity[i].defstrval = glogverbo;
+    logparams_verbosity[i].defstrval = glogverbo; 
     logparams_logfile[i].defstrval   = malloc(strlen(g_log->log_component[i].name) + 16);
     sprintf(logparams_logfile[i].defstrval,"/tmp/oai%s.log",g_log->log_component[i].name);
     logparams_logfile[i].numelt      = 0;
@@ -332,7 +332,7 @@ void  log_getconfig(log_t *g_log) {
     if ( logparams_logfile[i].defstrval != NULL) {
        free (logparams_logfile[i].defstrval);
     }
-  }
+    }
 }
 
 int register_log_component(char *name, char *fext, int compidx)
@@ -536,7 +536,7 @@ int logInit_log_mem (void)
       if ((pthread_mutex_init (&log_mem_lock, NULL) != 0)
           || (pthread_cond_init (&log_mem_notify, NULL) != 0)) {
         log_mem_d[1].enable_flag=0;
-        return 0;
+        return -1;
       }
       pthread_create(&log_mem_thread, NULL, (void *(*)(void *))log_mem_write, (void*)NULL);
     }else{
@@ -576,7 +576,7 @@ void nfapi_log(const char *file, const char *func, int line, int comp, int level
   /* for no gcc warnings */
   (void)log_start;
   (void)log_end;
-   
+
 
   c = &g_log->log_component[comp];
 
@@ -669,9 +669,44 @@ void nfapi_log(const char *file, const char *func, int line, int comp, int level
   va_end(args);
 
   // OAI printf compatibility
-  if ((g_log->onlinelog == 1) && (level != LOG_FILE))
+  if ((g_log->onlinelog == 1) && (level != LOG_FILE)) {
+    if(log_mem_flag==1){
+      if(log_mem_d[log_mem_side].enable_flag==1){
+        int temp_index;
+        temp_index=log_mem_d[log_mem_side].buf_index;
+        if(temp_index+len+1 < LOG_MEM_SIZE){
+          log_mem_d[log_mem_side].buf_index+=len;
+          memcpy(&log_mem_d[log_mem_side].buf_p[temp_index],log_buffer,len);
+        }else{
+          log_mem_d[log_mem_side].enable_flag=0;
+          if(log_mem_d[1-log_mem_side].enable_flag==1){
+            temp_index=log_mem_d[1-log_mem_side].buf_index;
+            if(temp_index+len+1 < LOG_MEM_SIZE){
+              log_mem_d[1-log_mem_side].buf_index+=len;
+              log_mem_side=1-log_mem_side;
+              memcpy(&log_mem_d[log_mem_side].buf_p[temp_index],log_buffer,len);
+              /* write down !*/
+              if (pthread_mutex_lock(&log_mem_lock) != 0) {
+                return;
+              }
+              if(log_mem_write_flag==0){
+                log_mem_write_side=1-log_mem_side;
+                if(pthread_cond_signal(&log_mem_notify) != 0) {
+                }
+              }
+              if(pthread_mutex_unlock(&log_mem_lock) != 0) {
+                return;
+              }
+            }else{
+              log_mem_d[1-log_mem_side].enable_flag=0;
+            }
+          }
+        }
+      }
+    }else{
       fwrite(log_buffer, len, 1, stdout);
-
+    }
+  }
 
   if (g_log->syslog) {
     syslog(g_log->level, "%s", log_buffer);
diff --git a/targets/RT/USER/lte-ru.c b/targets/RT/USER/lte-ru.c
index 0f785d75bf5a7f3748095ad46436395d8ed3b91a..be8436035ad7dcf5bf1f8e30a0a7881a5de1a700 100644
--- a/targets/RT/USER/lte-ru.c
+++ b/targets/RT/USER/lte-ru.c
@@ -2763,7 +2763,10 @@ void init_RU(char *rf_config_file) {
 
 
 void stop_ru(RU_t *ru) {
- 
+
+#if defined(PRE_SCD_THREAD) || defined(PHY_TX_THREAD)
+  int *status;
+#endif
   printf("Stopping RU %p processing threads\n",(void*)ru);
 #if defined(PRE_SCD_THREAD)
   if(ru){
diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c
index 6a7040983b55bb964b7e62dd9712254dd5e16568..b63abea12e49ded0025c8336e23f0acd734cb298 100644
--- a/targets/RT/USER/lte-softmodem.c
+++ b/targets/RT/USER/lte-softmodem.c
@@ -1228,6 +1228,7 @@ int main( int argc, char **argv )
   
   // connect the TX/RX buffers
  
+  sleep(1); /* wait for thread activation */
   
   printf("Sending sync to all threads\n");