 			free(host_ret_);
 			host_ret_ = nil;
 		}
+		if (mode_ == TEXTURE_MEMORY){
+			cudaUnbindTexture(t_vertex);
+			cudaUnbindTexture(t_points_nn);
+			cudaUnbindTexture(t_points);
+		}
 	}
 
 	__host__


	__host__
		void CudaRestrictedVoronoiDiagram::print_return_data(std::string filename) const{
		/*for (int i = 0; i < points_nb_; ++i)
		{
			if (fabs(host_ret_[i * 4 + 3]) >= 1e-12){
				host_ret_[i * 4 + 0] /= host_ret_[i * 4 + 3];
				host_ret_[i * 4 + 1] /= host_ret_[i * 4 + 3];
				host_ret_[i * 4 + 2] /= host_ret_[i * 4 + 3];
			}
		}*/
		index_t line_num = 4;
		std::ofstream f;
		f.open(filename);

		} while (assumed != old);

		return __longlong_as_double(old);
	}

	/*
	 * \brief fetch the double type in texture
	 */
	static __inline__ __device__
		double fetch_double(texture<int2, 1> t, index_t i){
		int2 v = tex1Dfetch(t, i);
		return __hiloint2double(v.y, v.x);
	}

	/*
