diff --git a/tools/wrappers/spm_fortran.py b/tools/wrappers/spm_fortran.py
index eefa8dd23e874780d2d5b672b6f70da18d40f217..4fff2927ac1697c78e58a260b7272a33619acf4d 100644
--- a/tools/wrappers/spm_fortran.py
+++ b/tools/wrappers/spm_fortran.py
@@ -34,8 +34,6 @@ enums = {
     'description' : "SPM fortran 90 wrapper to define enums and datatypes",
     'header'      : """
 
-#include "spm/config.h"
-
   use, intrinsic :: iso_c_binding
 #if defined(SPM_WITH_MPI)
   use :: mpi_f08, only : MPI_Comm, MPI_COMM_WORLD
@@ -108,6 +106,9 @@ function spmGetCptrFromValue(input) result(output)
      output = c_loc( t )
   type is (real(c_float))
      output = c_loc( t )
+  class default
+     write(0,*) "Input pointer is not pointing to one of double complex, single complex, double real or single real"
+     output = c_null_ptr
   end select
 
 end function spmGetCptrFromValue
@@ -128,6 +129,9 @@ function spmGetCptrFrom1dArray(input) result(output)
      output = c_loc( t )
   type is (real(c_float))
      output = c_loc( t )
+  class default
+     write(0,*) "Input pointer is not pointing to one of double complex, single complex, double real or single real"
+     output = c_null_ptr
   end select
 
 end function spmGetCptrFrom1dArray
@@ -148,6 +152,9 @@ function spmGetCptrFrom2dArray(input) result(output)
      output = c_loc( t )
   type is (real(c_float))
      output = c_loc( t )
+  class default
+     write(0,*) "Input pointer is not pointing to one of double complex, single complex, double real or single real"
+     output = c_null_ptr
   end select
 
 end function spmGetCptrFrom2dArray
diff --git a/tools/wrappers/wrap_fortran.py b/tools/wrappers/wrap_fortran.py
index 72e9114338f944103b6bfa14fd6098289ad330e7..82328c726090ffb32969fb7075e0612a969bea3a 100644
--- a/tools/wrappers/wrap_fortran.py
+++ b/tools/wrappers/wrap_fortran.py
@@ -609,7 +609,7 @@ def iso_c_interface_type(arg, return_value, list, instruct=False):
     else:
         f_type = types_dict[arg[0]]['ftype']
         if instruct and f_type == "type(MPI_Comm)":
-            f_type = "integer(kind=SPM_MPI_COMM_SIZE)"
+            f_type = "integer(kind=SPM_MPI_COMM_KIND)"
 
     if (not return_value and arg[1] != "**"):
         f_type += ", "