diff --git a/executables/nr-gnb.c b/executables/nr-gnb.c
index f5c53dbc2247f1919e88c9722ec66c29aae4f766..9c9a02c93468dcc7a93d0c685b087cdc72a85726 100644
--- a/executables/nr-gnb.c
+++ b/executables/nr-gnb.c
@@ -104,6 +104,7 @@ extern openair0_config_t openair0_cfg[MAX_CARDS];
 extern int transmission_mode;
 
 uint16_t sf_ahead=3;
+uint16_t sl_ahead;
 //pthread_t                       main_gNB_thread;
 
 time_stats_t softmodem_stats_mt; // main thread
@@ -398,6 +399,7 @@ void gNB_top(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, char *string, struct
   RU_proc_t *ru_proc=&ru->proc;
   proc->frame_rx    = frame_rx;
   proc->slot_rx = slot_rx;
+  sl_ahead = sf_ahead*fp->slots_per_subframe;
 
   if (!oai_exit) {
     T(T_ENB_MASTER_TICK, T_INT(0), T_INT(proc->frame_rx), T_INT(proc->slot_rx));
diff --git a/executables/nr-ru.c b/executables/nr-ru.c
index dcc662b4b0c7c610f92859e42ae15a827edb08f1..a7e2c0f0d5aa55fc588de9bcfb8567eda3745464 100644
--- a/executables/nr-ru.c
+++ b/executables/nr-ru.c
@@ -132,6 +132,7 @@ int attach_rru(RU_t *ru);
 int connect_rau(RU_t *ru);
 
 extern uint16_t sf_ahead;
+extern uint16_t sl_ahead;
 
 extern int emulate_rf;
 extern int numerology;
diff --git a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c
index 770e27dd608b5c4063c514e0f20400e3e332c2c6..91c75ac67fdf1bf90644af4e76ae8bbad8352e5f 100644
--- a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c
+++ b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c
@@ -51,6 +51,7 @@ extern int oai_nfapi_sr_indication(nfapi_sr_indication_t *ind);
 extern int oai_nfapi_rx_ind(nfapi_rx_indication_t *ind);
 extern uint8_t nfapi_mode;
 extern uint16_t sf_ahead;
+extern uint16_t sl_ahead;
 
 void handle_nr_rach(NR_UL_IND_t *UL_info) {
   if (UL_info->rach_ind.rach_indication_body.number_of_preambles>0) {
@@ -261,22 +262,22 @@ void NR_UL_indication(NR_UL_IND_t *UL_info) {
     if (ifi->CC_mask == ((1<<MAX_NUM_CCs)-1)) {
       /*
       eNB_dlsch_ulsch_scheduler(module_id,
-          (UL_info->frame+((UL_info->slot>(9-sf_ahead))?1:0)) % 1024,
-          (UL_info->slot+sf_ahead)%10);
+          (UL_info->frame+((UL_info->slot>(9-sl_ahead))?1:0)) % 1024,
+          (UL_info->slot+sl_ahead)%10);
       */
       nfapi_nr_config_request_scf_t *cfg = &mac->config[CC_id];
       int spf = get_spf(cfg);
       gNB_dlsch_ulsch_scheduler(module_id,
 				UL_info->frame,
 				UL_info->slot,
-				(UL_info->frame+((UL_info->slot>(spf-1-sf_ahead))?1:0)) % 1024,
-				(UL_info->slot+sf_ahead)%spf);
+				(UL_info->frame+((UL_info->slot>(spf-1-sl_ahead))?1:0)) % 1024,
+				(UL_info->slot+sl_ahead)%spf);
       
       ifi->CC_mask            = 0;
       sched_info->module_id   = module_id;
       sched_info->CC_id       = CC_id;
-      sched_info->frame       = (UL_info->frame + ((UL_info->slot>(spf-1-sf_ahead)) ? 1 : 0)) % 1024;
-      sched_info->slot        = (UL_info->slot+sf_ahead)%spf;
+      sched_info->frame       = (UL_info->frame + ((UL_info->slot>(spf-1-sl_ahead)) ? 1 : 0)) % 1024;
+      sched_info->slot        = (UL_info->slot+sl_ahead)%spf;
       sched_info->DL_req      = &mac->DL_req[CC_id];
       sched_info->UL_dci_req  = &mac->UL_dci_req[CC_id];