diff --git a/openair2/ENB_APP/flexran_agent.c b/openair2/ENB_APP/flexran_agent.c
index d6402658a93958b5005aada432d9a5a1173d1a84..ff91d711d986c9a785e264ff2257ef0c329a9350 100644
--- a/openair2/ENB_APP/flexran_agent.c
+++ b/openair2/ENB_APP/flexran_agent.c
@@ -235,8 +235,11 @@ int flexran_agent_start(mid_t mod_id)
    */
 
   /*Initialize the continuous stats update mechanism*/
-  flexran_agent_init_cont_stats_update(mod_id);
-  
+  if (flexran_agent_init_cont_stats_update(mod_id) < 0) {
+    LOG_E(FLEXRAN_AGENT, "could not initialize continuous stats updates\n");
+    goto error;
+  }
+
   new_thread(receive_thread, flexran);
 
   /* Register and initialize the control modules depending on capabilities.
diff --git a/openair2/ENB_APP/flexran_agent_handler.c b/openair2/ENB_APP/flexran_agent_handler.c
index 40c09ddef9465790a6675501662caeb90eb06a92..5e1cf7809a7608839322d107afd0572e0f7294ef 100644
--- a/openair2/ENB_APP/flexran_agent_handler.c
+++ b/openair2/ENB_APP/flexran_agent_handler.c
@@ -730,7 +730,7 @@ err_code_t flexran_agent_init_cont_stats_update(mid_t mod_id) {
   stats_context[mod_id].mutex = calloc(1, sizeof(pthread_mutex_t));
   if (stats_context[mod_id].mutex == NULL)
     goto error;
-  if (pthread_mutex_init(stats_context[mod_id].mutex, NULL))
+  if (pthread_mutex_init(stats_context[mod_id].mutex, NULL) != 0)
     goto error;
 
   return 0;