diff --git a/openair2/LAYER2/MAC/ra_procedures.c b/openair2/LAYER2/MAC/ra_procedures.c
index b62c8e66ed3ee5fa28c8bb5190c3a2a8904180c5..84fa2a99d970e0f5a5ee459c8c0f2f322f6cd933 100644
--- a/openair2/LAYER2/MAC/ra_procedures.c
+++ b/openair2/LAYER2/MAC/ra_procedures.c
@@ -122,7 +122,7 @@ void get_prach_resources(module_id_t module_idP,
   RACH_ConfigCommon_t *rach_ConfigCommon = NULL;
   uint8_t noGroupB = 0;
   uint8_t f_id = 0,num_prach=0;
-  int numberOfRA_Preambles = (1+rach_ConfigCommon->preambleInfo.numberOfRA_Preambles)<<2;  
+  int numberOfRA_Preambles;
   int messageSizeGroupA;
   int sizeOfRA_PreamblesGroupA;
   int messagePowerOffsetGroupB;
@@ -142,6 +142,8 @@ void get_prach_resources(module_id_t module_idP,
     return; // not reached
   }
 
+  numberOfRA_Preambles = (1+rach_ConfigCommon->preambleInfo.numberOfRA_Preambles)<<2;  
+
   if (rach_ConfigDedicated) {   // This is for network controlled Mobility, later
     if (rach_ConfigDedicated->ra_PRACH_MaskIndex != 0) {
       prach_resources->ra_PreambleIndex = rach_ConfigDedicated->ra_PreambleIndex;