diff --git a/CMakeLists.txt b/CMakeLists.txt
index d2530cc7992bbdba69149f6d619e3fb5e80ed9b0..b41c39b4b1553893a6ea91b84d429b282c4eb4ca 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -14,7 +14,6 @@ endif()
 set(BOOST_INCLUDE ${Boost_INCLUDE_DIR} CACHE PATH "Include directory for BOOST")
 set(HDF5_ROOT CACHE PATH "HDF5 root path")
 set(SE_CLASS1 CACHE BOOL "Activate compilation with SE_CLASS1")
-set(SE_CLASS2 CACHE BOOL "Activate compilation with SE_CLASS2")
 set(SE_CLASS3 CACHE BOOL "Activate compilation with SE_CLASS3")
 set(ENV{HDF5_ROOT} ${HDF5_ROOT})
 set(OPENFPM_PDATA_DIR CACHE PATH "OpenFPM_pdata dirs")
@@ -68,10 +67,6 @@ if(SE_CLASS1)
 	set(DEFINE_SE_CLASS1 "#define SE_CLASS1")
 endif()
 
-if(SE_CLASS2)
-	set(DEFINE_SE_CLASS2 "#define SE_CLASS2")
-endif()
-
 if(SE_CLASS3)
 	set(DEFINE_SE_CLASS3 "#define SE_CLASS3")
 endif()
diff --git a/configure b/configure
index 58a970ce6f68fb305ca1699444b61d7e9cd02c7d..8b284b8e6a6ff5af329ad0a1da39ed79cad353c9 100755
--- a/configure
+++ b/configure
@@ -104,7 +104,6 @@ enable_test_performance
 enable_test_coverage
 with_parmetis
 enable_se_class1
-enable_se_class2
 enable_se_class3
 with_action_on_error
 with_boost
@@ -220,9 +219,6 @@ do
     se_class1)
        conf_options="$conf_options -DSE_CLASS1=ON"
        ;;
-    se_class2)
-       conf_options="$conf_options -DSE_CLASS2=ON"
-       ;;
     se_class3)
        conf_options="$conf_options -DSE_CLASS3=ON"
        ;;
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 5d5a50ad61d6a31053891ddb66f4fe8f895111d6..2c3cb1063bc1efdd8d95f1ba184b94d0cbae84d9 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -9,7 +9,6 @@ add_executable(io main.cpp
 				  ../../openfpm_vcluster/src/VCluster/VCluster.cpp 
 				  ../../openfpm_devices/src/memory/CudaMemory.cu 
 				  ../../openfpm_devices/src/memory/HeapMemory.cpp 
-				  ../../openfpm_devices/src/Memleak_check.cpp 
 				  ../../openfpm_devices/src/memory/PtrMemory.cpp)
 
 if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
diff --git a/src/HDF5_wr/HDF5_writer_gd.hpp b/src/HDF5_wr/HDF5_writer_gd.hpp
index 8a1b98e78d433c6975940e2373287c893e0f30c1..f41de0fec8f6c888a78e2f2118c7f1b0e6048576 100644
--- a/src/HDF5_wr/HDF5_writer_gd.hpp
+++ b/src/HDF5_wr/HDF5_writer_gd.hpp
@@ -173,6 +173,9 @@ public:
 	    H5Sclose(file_dataspace_id_2);
 	    H5Pclose(plist_id);
 	    H5Fclose(file);
+
+	    mem.decRef();
+	    delete &mem;
 	}
 
 };
diff --git a/src/HDF5_wr/HDF5_writer_vd.hpp b/src/HDF5_wr/HDF5_writer_vd.hpp
index 70015ba6f6acff2f6aab85634032bfff6e78d2c2..f6bd869a75ee2bb1897f6cb9ab982ca85ab50a9e 100644
--- a/src/HDF5_wr/HDF5_writer_vd.hpp
+++ b/src/HDF5_wr/HDF5_writer_vd.hpp
@@ -156,6 +156,8 @@ public:
 		H5Sclose(mem_dataspace_id);
 		H5Pclose(plist_id);
 		H5Fclose(file);
+		mem.decRef();
+		delete &mem;
 	}
 
 	/*! \brief Return the equivalent HDF5 type for T
diff --git a/src/config/config_cmake.h.in b/src/config/config_cmake.h.in
index 02de32fc4b93d79ac946dbb08127a707b6f7de44..85840022fcec2c75463a60a05aa6c09b76ea448e 100644
--- a/src/config/config_cmake.h.in
+++ b/src/config/config_cmake.h.in
@@ -140,9 +140,6 @@ ${DEFINE_PERFORMANCE_TEST}
 /* Security enhancement class 1 */
 ${DEFINE_SE_CLASS1}
 
-/* Security enhancement class 2 */
-${DEFINE_SE_CLASS2}
-
 /* Security enhancement class 3 */
 ${DEFINE_SE_CLASS3}