 void Free_Memory_Simple_3D(){
   
   // free CPU memory
-  if (block_tot > 1) free(buffer);
-  free(host_dti_array);  
+  if (block_tot > 1) CudaSafeCall( cudaFreeHost(buffer) );
+  CudaSafeCall( cudaFreeHost(host_dti_array) );  
   #ifdef COOLING_GPU
-  free(host_dt_array);  
+  CudaSafeCall( cudaFreeHost(host_dt_array) );  
   #endif  
   
   // free the GPU memory


    // allocate buffer to copy conserved variable blocks to/from
    if (block_tot > 1) {
      if ( NULL == ( buffer = (Real *) malloc(n_fields*BLOCK_VOL*sizeof(Real)) ) ) {
        printf("Failed to allocate CPU buffer.\n");
      }
      tmp1 = buffer;

      temp_potential = buffer_potential;
    }
    // allocate an array on the CPU to hold max_dti returned from each thread block
    CudaSafeCall( cudaHostAlloc(&host_dti_array, ngrid*sizeof(Real), cudaHostAllocDefault) );
    #ifdef COOLING_GPU
    CudaSafeCall( cudaHostAlloc(&host_dt_array, ngrid*sizeof(Real), cudaHostAllocDefault) );
    #endif  

    // allocate memory on the GPU
