diff --git a/openair1/PHY/LTE_TRANSPORT/dci_tools.c b/openair1/PHY/LTE_TRANSPORT/dci_tools.c
index c9d68cd0aad7b4f3ade100c940d3ea8e658f81b9..f2d22e523131533c8e39853cbf7c93a3be842e3e 100644
--- a/openair1/PHY/LTE_TRANSPORT/dci_tools.c
+++ b/openair1/PHY/LTE_TRANSPORT/dci_tools.c
@@ -734,11 +734,11 @@ void generate_RIV_tables()
       if (nVRB<32)
         alloc0 |= (1<<nVRB);
       else if (nVRB<64)
-        alloc1 |= (1<<(nVRB-33));
+        alloc1 |= (1<<(nVRB-32));
       else if (nVRB<96)
-        alloc2 |= (1<<(nVRB-65));
+        alloc2 |= (1<<(nVRB-64));
       else
-        alloc3 |= (1<<(nVRB-97));
+        alloc3 |= (1<<(nVRB-96));
 
       // Distributed Gap1, even slot
       nVRB_even_dist = get_prb(100,0,nVRB,0);
@@ -770,9 +770,9 @@ void generate_RIV_tables()
       else if (nVRB_odd_dist<64)
         allocdist1_0_odd |= (1<<(nVRB_odd_dist-32));
       else if (nVRB_odd_dist<96)
-	allocdist2_0_odd |= (1<<(nVRB_odd_dist-65));
+	allocdist2_0_odd |= (1<<(nVRB_odd_dist-64));
       else
-	allocdist3_0_odd |= (1<<(nVRB_odd_dist-97));
+	allocdist3_0_odd |= (1<<(nVRB_odd_dist-96));
 
 
       // Distributed Gap2, even slot
diff --git a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c
index 7162501f89d8b3a8ee23e0b5cf160a868b1ea266..d709dcdfda1f310463159e507d3d3943994b853d 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c
@@ -991,13 +991,11 @@ int allocate_CCEs(int module_idP,
   int allocation_is_feasible = 1;
   DCI_ALLOC_t *dci_alloc;
 
-
   LOG_D(MAC,"Allocate CCEs subframe %d, test %d : (common %d,uspec %d)\n",subframeP,test_onlyP,DCI_pdu->Num_common_dci,DCI_pdu->Num_ue_spec_dci);
 
-  init_CCE_table(module_idP,CC_idP);
-  DCI_pdu->nCCE=0;
-
   while (allocation_is_feasible == 1) {
+    init_CCE_table(module_idP,CC_idP);
+    DCI_pdu->nCCE=0;
 
     for (i=0;i<DCI_pdu->Num_common_dci + DCI_pdu->Num_ue_spec_dci;i++) {
       dci_alloc = &DCI_pdu->dci_alloc[i];