 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

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

    // allocate memory on the GPU


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