diff --git a/src/fmpi_core.c b/src/fmpi_core.c
index 7567eea86a9247c960c744def2e8b30e1a1b66f9..cb9065c1c4e0d384df797cfc89fa33f7cdc8e415 100644
--- a/src/fmpi_core.c
+++ b/src/fmpi_core.c
@@ -53,7 +53,12 @@ struct fmpi_ctx * fmpi_init(int * const argc, char ** argv[])
 int fmpi_exit(struct fmpi_ctx ** const ctx)
 {
     assert(ctx != NULL);
-    return fmpi_ctx_destroy(ctx);
+    assert(*ctx != NULL);
+    const int err = fmpi_ctx_destroy(ctx);
+    if(err != FMPI_SUCCESS) {
+        fprintf(stderr, "fmpi_ctx_destroy() failed!\n");
+    }
+    return err;
 }
 /*------------------------------------------------------------------------------
     fmpi_abort()
@@ -79,7 +84,7 @@ int fmpi_world_rank(const struct fmpi_ctx * const ctx)
 {
     assert(ctx != NULL);
     const int rank = fmpi_mpi_world_rank(ctx->mpi);
-    if(rank < 0) {
+    if(rank < FMPI_SUCCESS) {
         FMPI_RAISE_ERROR(ctx->err_handler, "FMPI", "fmpi_mpi_world_rank() failed!");
     }
     return rank;
@@ -90,11 +95,11 @@ int fmpi_world_rank(const struct fmpi_ctx * const ctx)
 int fmpi_world_barrier(const struct fmpi_ctx * const ctx)
 {
     assert(ctx != NULL);
-    const int err_id = fmpi_mpi_world_barrier(ctx->mpi);
-    if(err_id == -1) {
+    const int err = fmpi_mpi_world_barrier(ctx->mpi);
+    if(err != FMPI_SUCCESS) {
         FMPI_RAISE_ERROR(ctx->err_handler, "FMPI", "fmpi_mpi_world_barrier() failed!");
     }
-    return err_id;
+    return err;
 }
 /*------------------------------------------------------------------------------
     fmpi_run_task()
@@ -105,9 +110,20 @@ int fmpi_run_task(
     assert(ctx != NULL);
     assert(task != NULL);
     if(task->type == FMPI_TASK_TYPE_SYNC) {
-        return fmpi_task_run_sync(ctx, task);
+        const int err = fmpi_task_run_sync(ctx, task);
+        if(err != FMPI_SUCCESS) {
+            FMPI_RAISE_ERROR(ctx->err_handler, "FMPI", "fmpi_task_run_sync() failed!");
+        }
+        return err;
+    }
+    if(task->type == FMPI_TASK_TYPE_ASYNC) {
+        const int err = fmpi_task_run_async(ctx, task);
+        if(err != FMPI_SUCCESS) {
+            FMPI_RAISE_ERROR(ctx->err_handler, "FMPI", "fmpi_task_run_async() failed!");
+        }
+        return err;
     }
-    return fmpi_task_run_async(ctx, task);
+    return FMPI_ERROR;
 }
 /*------------------------------------------------------------------------------
     fmpi_sync()
@@ -115,5 +131,9 @@ int fmpi_run_task(
 int fmpi_sync(const struct fmpi_ctx * const ctx)
 {
     assert(ctx != NULL);
-    return fmpi_futhark_sync(ctx->fut);
+    const int err = fmpi_futhark_sync(ctx->fut);
+    if(err != FMPI_SUCCESS) {
+        FMPI_RAISE_ERROR(ctx->err_handler, "FMPI", "fmpi_futhark_sync() failed!");
+    }
+    return err;
 }