 				CheckCUDAError("kernel function");
 				
 				copy_back();
+				//debug
 				//int c   = host_ret_[0];
-				//result_print("retdata.txt", host_ret_, points_nb_ * 4, 4);
-				is_store_ = false;
+				//std::ifstream in("C:\\Users\\JWhan\\Desktop\\DATA\\visited_nb.txt");
+				//int* temp = (int*)malloc(sizeof(int) * facet_nb_);
+				//for (index_t t = 0; t < facet_nb_; ++t){
+				//	in >> temp[t];
+				//	//std::cout << temp[t];
+				//	if ((index_t)host_ret_[t] != (index_t)temp[t]){
+				//		std::cout << "Mismatch in facet " << t << " !"
+				//			<< "my number = " << host_ret_[t]
+				//			<< "  correct number = "
+				//			<< temp[t] << std::endl;
+				//	}
+				//}
+				
+				//end debug
+				result_print("retdata.txt", host_ret_, points_nb_ * 4, 4);
+				//is_store_ = false;
 				update_points();
 				iter_watcher.stop();
 				iter_watcher.synchronize();

				points_nn,
				k_p
				); if (current_polygon.vertex_nb < 3 /*|| current_polygon.vertex_nb > 6*/) break;
			if (tid == facets_nb - 1 && counter == 3){
				/*int idx = 0;
				double* ret = retdata + pid * 32;
				ret[0] = has_visited_nb[facetidx_in_block];


		__shared__ index_t has_visited[64][CUDA_Stack_size];
		__shared__ index_t has_visited_nb[64];
		
		bool has_visited_flag = false;
		index_t facetidx_in_block = (index_t)threadIdx.x / k_f;
		int cur = pid;
