diff --git a/openair2/LAYER2/MAC/config_NB_IoT.c b/openair2/LAYER2/MAC/config_NB_IoT.c
index 789533550af828cc73f04f3fef199b7dc04814b4..062f830187fa79adf2f52f46a1a545d0dbfb55be 100644
--- a/openair2/LAYER2/MAC/config_NB_IoT.c
+++ b/openair2/LAYER2/MAC/config_NB_IoT.c
@@ -72,7 +72,7 @@ int32_t get_uldl_offset_NB_IoT(int eutra_band) {
   return(-eutra_bandtable[eutra_band].dl_min + eutra_bandtable[eutra_band].ul_min);
 }
 
-uint32_t to_earfcn(int eutra_bandP,uint32_t dl_CarrierFreq, float m_dl) {
+uint32_t to_earfcn_NB_IoT(int eutra_bandP,uint32_t dl_CarrierFreq, float m_dl) {
 
   uint32_t dl_CarrierFreq_by_100k = dl_CarrierFreq/100000;
 
@@ -198,7 +198,7 @@ void config_mib_fapi_NB_IoT(
      * 1) takes a random number from the offset of category NB1 and NB2 based on the operating mode (we assume always the usage of anchor carrier)
      * 2)evaluate the EARFCN value based on the corresponding formula
      */
-    config_INFO->cfg->nfapi_config.earfcn.value = to_earfcn(eutra_band,dl_CarrierFreq, m_dl);
+    config_INFO->cfg->nfapi_config.earfcn.value = to_earfcn_NB_IoT(eutra_band,dl_CarrierFreq, m_dl);
 
 }
 
diff --git a/openair2/LAYER2/MAC/defs_NB_IoT.h b/openair2/LAYER2/MAC/defs_NB_IoT.h
index 8d713da8b23720d5461b26584d4f332f03d17170..27b2e1c115c117bad98214dc9e5d6ded9c3c83f1 100644
--- a/openair2/LAYER2/MAC/defs_NB_IoT.h
+++ b/openair2/LAYER2/MAC/defs_NB_IoT.h
@@ -233,7 +233,7 @@ typedef struct{
 typedef struct {
 
   /// DCI template and MAC connection parameters for UEs
-  UE_TEMPLATE_NB_IoT UE_template_NB_IoT[NUMBER_OF_UE_MAX_NB_IoT];
+  UE_TEMPLATE_NB_IoT UE_template_NB_IoT[MAX_NUMBER_OF_UE_MAX_NB_IoT];
 
   /// NPDCCH Period and searching space info
   NPDCCH_config_dedicated_NB_IoT_t NPDCCH_config_dedicated;
diff --git a/openair2/LAYER2/MAC/eNB_scheduler_RA_NB_IoT.c b/openair2/LAYER2/MAC/eNB_scheduler_RA_NB_IoT.c
index b3f61d2d854d15b32d0d1fa3a724c82552799a3e..ae9ab02103ebbc63475282de5e7cfac573733f77 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler_RA_NB_IoT.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler_RA_NB_IoT.c
@@ -480,6 +480,8 @@ void schedule_msg4_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst){
 	schedule_result_t *msg4_result;
 	schedule_result_t *harq_result;
 
+	msg4_node = (available_resource_DL_t *)0;
+
 	//print_available_resource_DL();
 
 	while((RA_TEMPLATE_NB_IoT *)0 != msg4_nodes){
diff --git a/openair2/LAYER2/MAC/proto_NB_IoT.h b/openair2/LAYER2/MAC/proto_NB_IoT.h
index 9f5edd21cb967730e7da2808f2094eb940441a08..351a2b4b55463707efc5f9561aa3f2186a1954ae 100644
--- a/openair2/LAYER2/MAC/proto_NB_IoT.h
+++ b/openair2/LAYER2/MAC/proto_NB_IoT.h
@@ -97,7 +97,7 @@ void convert_system_number(uint32_t source_sf,uint32_t *hyperSF, uint32_t *frame
 
 uint32_t convert_system_number_sf(uint32_t hyperSF, uint32_t frame, uint32_t subframe);
 
-uint32_t to_earfcn(int eutra_bandP,uint32_t dl_CarrierFreq, float m_dl);
+uint32_t to_earfcn_NB_IoT(int eutra_bandP,uint32_t dl_CarrierFreq, float m_dl);
 
 uint32_t from_earfcn_NB_IoT(int eutra_bandP,uint32_t dl_earfcn, float m_dl);
 
diff --git a/openair2/LAYER2/MAC/schedule_tool_NB_IoT.c b/openair2/LAYER2/MAC/schedule_tool_NB_IoT.c
index 4cb0c5d96cfba7b265d54364d1f04a4058442eda..6a00e32028187dc1b4a59923ccca22d3229e246d 100644
--- a/openair2/LAYER2/MAC/schedule_tool_NB_IoT.c
+++ b/openair2/LAYER2/MAC/schedule_tool_NB_IoT.c
@@ -179,11 +179,10 @@ void Initialize_Resource(void){
 //	extend subframe align to si-period
 void extend_available_resource_DL(eNB_MAC_INST_NB_IoT *mac_inst, int max_subframe){	//	assume max_subframe is found.
     
-	available_resource_DL_t *pt, *new_node;
+	available_resource_DL_t *new_node;
 	//int temp;
 	uint32_t i, i_div_si_window;
 	//uint32_t si_period_div_window;
-	pt = available_resource_DL;
     
     printf("%d %d\n", max_subframe, mac_inst->schedule_subframe_DL);