diff --git a/openair3/NAS/TOOLS/usim_data.c b/openair3/NAS/TOOLS/usim_data.c
index 23eba29bb134cf1fa3ad8a9bacec4f546d23cd96..4e3027691f6c096039cea05481641e43fd136ff0 100644
--- a/openair3/NAS/TOOLS/usim_data.c
+++ b/openair3/NAS/TOOLS/usim_data.c
@@ -100,6 +100,16 @@ int main (int argc, const char* argv[])
 
   unsigned char gen_data;
 
+  /* Get USIM application pathname */
+  char* path = memory_get_path(USIM_API_NVRAM_DIRNAME,
+                               USIM_API_NVRAM_FILENAME);
+
+  if (path == NULL) {
+    fprintf(stderr, "USIM-API  - Failed to get USIM pathname");
+    free(path);
+    exit(EXIT_FAILURE);
+  }
+
   /*
    * Read command line parameters
    */
@@ -415,7 +425,7 @@ int main (int argc, const char* argv[])
     /*
      * Write USIM application data
      */
-    rc = usim_api_write(&usim_data);
+    rc = usim_api_write(path, &usim_data);
 
     if (rc != RETURNok) {
       perror("ERROR\t: usim_api_write() failed");
@@ -427,7 +437,7 @@ int main (int argc, const char* argv[])
    * Read USIM application data
    */
   memset(&usim_data, 0, sizeof(usim_data_t));
-  rc = usim_api_read(&usim_data);
+  rc = usim_api_read(path, &usim_data);
 
   if (rc != RETURNok) {
     perror("ERROR\t: usim_api_read() failed");
@@ -443,7 +453,6 @@ int main (int argc, const char* argv[])
   /*
    * Display USIM file location
    */
-  char* path = memory_get_path("USIM_DIR", ".usim.nvram");
   printf("\nUSIM data file: %s\n", path);
   free(path);
 
diff --git a/openair3/NAS/UE/API/USIM/usim_api.c b/openair3/NAS/UE/API/USIM/usim_api.c
index 00252d2c03853155540124812b1f100329e04f18..ef6b4f910102e408363e61b059b3004d7012381f 100644
--- a/openair3/NAS/UE/API/USIM/usim_api.c
+++ b/openair3/NAS/UE/API/USIM/usim_api.c
@@ -47,6 +47,7 @@ Description Implements the API used by the NAS layer to read/write
 #include "aka_functions.h"
 #include <string.h> // memcpy, memset
 #include <stdlib.h> // malloc, free
+#include <stdio.h>
 
 /****************************************************************************/
 /****************  E X T E R N A L    D E F I N I T I O N S  ****************/
@@ -56,17 +57,6 @@ Description Implements the API used by the NAS layer to read/write
 /*******************  L O C A L    D E F I N I T I O N S  *******************/
 /****************************************************************************/
 
-/*
- * The name of the file where are stored data of the USIM application
- */
-#define USIM_API_NVRAM_FILENAME ".usim.nvram"
-
-/*
- * The name of the environment variable which defines the directory
- * where the USIM application file is located
- */
-#define USIM_API_NVRAM_DIRNAME  "USIM_DIR"
-
 static int _usim_api_check_sqn(uint32_t seq, uint8_t ind);
 
 /****************************************************************************/
@@ -87,24 +77,14 @@ static int _usim_api_check_sqn(uint32_t seq, uint8_t ind);
  **              Others:        None                                       **
  **                                                                        **
  ***************************************************************************/
-int usim_api_read(usim_data_t* data)
+int usim_api_read(const char *filename, usim_data_t* data)
 {
   LOG_FUNC_IN;
 
-  /* Get USIM application pathname */
-  char* path = memory_get_path(USIM_API_NVRAM_DIRNAME,
-                               USIM_API_NVRAM_FILENAME);
-
-  if (path == NULL) {
-    LOG_TRACE(ERROR, "USIM-API  - Failed to get USIM pathname");
-    LOG_FUNC_RETURN (RETURNerror);
-  }
-
   /* Read USIM application data */
-  if (memory_read(path, data, sizeof(usim_data_t)) != RETURNok) {
+  if (memory_read(filename, data, sizeof(usim_data_t)) != RETURNok) {
     LOG_TRACE(ERROR, "USIM-API  - %s file is either not valid "
-              "or not present", path);
-    free(path);
+              "or not present", filename);
     LOG_FUNC_RETURN (RETURNerror);
   }
 
@@ -123,7 +103,7 @@ int usim_api_read(usim_data_t* data)
              0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 };
   #endif
   memcpy(data->keys.op, _op, sizeof(_op));
-  free(path);
+
   LOG_FUNC_RETURN (RETURNok);
 }
 
@@ -141,28 +121,17 @@ int usim_api_read(usim_data_t* data)
  **              Others:        None                                       **
  **                                                                        **
  ***************************************************************************/
-int usim_api_write(const usim_data_t* data)
+int usim_api_write(const char *filename, const usim_data_t* data)
 {
   LOG_FUNC_IN;
 
-  /* Get USIM application pathname */
-  char* path = memory_get_path(USIM_API_NVRAM_DIRNAME,
-                               USIM_API_NVRAM_FILENAME);
-
-  if (path == NULL) {
-    LOG_TRACE(ERROR, "USIM-API  - Failed to get USIM pathname");
-    LOG_FUNC_RETURN (RETURNerror);
-  }
-
   /* Write USIM application data */
-  if (memory_write(path, data, sizeof(usim_data_t)) != RETURNok) {
+  if (memory_write(filename, data, sizeof(usim_data_t)) != RETURNok) {
 
-    LOG_TRACE(ERROR, "USIM-API  - Unable to write USIM file %s", path);
-    free(path);
+    LOG_TRACE(ERROR, "USIM-API  - Unable to write USIM file %s", filename);
     LOG_FUNC_RETURN (RETURNerror);
   }
 
-  free(path);
   LOG_FUNC_RETURN (RETURNok);
 }
 
diff --git a/openair3/NAS/UE/API/USIM/usim_api.h b/openair3/NAS/UE/API/USIM/usim_api.h
index 9114150396b79ac65ba012f82c286a808e2a68d4..74123029dd9406aabcbe9d74c3636da0bd8dc2d2 100644
--- a/openair3/NAS/UE/API/USIM/usim_api.h
+++ b/openair3/NAS/UE/API/USIM/usim_api.h
@@ -54,6 +54,17 @@ Description Implements the API used by the NAS layer to read/write
 #define USIM_API_K_SIZE         16
 #define USIM_API_K_VALUE        "fec86ba6eb707ed08905757b1bb44b8f"
 
+/*
+ * The name of the file where are stored data of the USIM application
+ */
+#define USIM_API_NVRAM_FILENAME ".usim.nvram"
+
+/*
+ * The name of the environment variable which defines the directory
+ * where the USIM application file is located
+ */
+#define USIM_API_NVRAM_DIRNAME  "USIM_DIR"
+
 /****************************************************************************/
 /************************  G L O B A L    T Y P E S  ************************/
 /****************************************************************************/
@@ -366,9 +377,9 @@ typedef struct {
 /******************  E X P O R T E D    F U N C T I O N S  ******************/
 /****************************************************************************/
 
-int usim_api_read(usim_data_t* data);
+int usim_api_read(const char *filename, usim_data_t* data);
 
-int usim_api_write(const usim_data_t* data);
+int usim_api_write(const char *filename, const usim_data_t* data);
 
 int usim_api_authenticate(usim_data_t *usim_data, const OctetString* rand_pP, const OctetString* autn_pP,
                           OctetString* auts, OctetString* res,
diff --git a/openair3/NAS/UE/EMM/emm_main.c b/openair3/NAS/UE/EMM/emm_main.c
index 2de879506ac25d4dc628ef05abf2fe7df1033479..980deb158302e50030ce8e33ae7d310b165fa599 100644
--- a/openair3/NAS/UE/EMM/emm_main.c
+++ b/openair3/NAS/UE/EMM/emm_main.c
@@ -193,7 +193,7 @@ void emm_main_initialize(nas_user_t *user, emm_indication_callback_t cb, const c
   /*
    * Get USIM application data
    */
-  if ( usim_api_read(&user->usim_data) != RETURNok ) {
+  if ( usim_api_read(user->usim_data_store, &user->usim_data) != RETURNok ) {
     /* The USIM application may not be present or not valid */
     LOG_TRACE(WARNING, "EMM-MAIN  - Failed to read USIM application data");
   } else {
diff --git a/openair3/NAS/UE/nas_ue_task.c b/openair3/NAS/UE/nas_ue_task.c
index 1860007b3a565356268f4aa29c7ff402f042fc9b..3d45f5ac1ba044c5f487679a5e09b3ec3187b4c2 100644
--- a/openair3/NAS/UE/nas_ue_task.c
+++ b/openair3/NAS/UE/nas_ue_task.c
@@ -31,6 +31,7 @@
 # include "nas_parser.h"
 # include "nas_proc.h"
 # include "msc.h"
+# include "memory.h"
 
 #include "nas_user.h"
 
@@ -94,6 +95,13 @@ void *nas_ue_task(void *args_p)
   MSC_START_USE();
   /* Initialize UE NAS (EURECOM-NAS) */
   {
+    /* Get USIM data application filename */
+    user->usim_data_store = memory_get_path(USIM_API_NVRAM_DIRNAME, USIM_API_NVRAM_FILENAME);
+    if ( user->usim_data_store == NULL ) {
+      LOG_E(NAS, "[UE %d] - Failed to get USIM data application filename", user->ueid);
+      exit(EXIT_FAILURE);
+    }
+
     /* Initialize user interface (to exchange AT commands with user process) */
     nas_user_api_id_initialize(user);
     user->user_at_commands = calloc_or_fail(sizeof(user_at_commands_t));
diff --git a/openair3/NAS/UE/user_defs.h b/openair3/NAS/UE/user_defs.h
index 53cab4edb48036a4212a5ac9660f249d217bd109..caa2017f8d1043ee65edb135cc2c288102b162ba 100644
--- a/openair3/NAS/UE/user_defs.h
+++ b/openair3/NAS/UE/user_defs.h
@@ -75,6 +75,7 @@ typedef struct {
   security_data_t *security_data; //Internal data used for security mode control procedure
   // Hardware persistent storage
   usim_data_t usim_data; // USIM application data
+  const char *usim_data_store; // USIM application data filename
   user_nvdata_t *nas_user_nvdata; //UE parameters stored in the UE's non-volatile memory device
   //
   nas_user_context_t *nas_user_context;