 		transformedRay.dir = mtxW2L.applyXYZ(r.dir);
 		transformedRay.dir = normalize(transformedRay.dir);
 
-		if (intersectBVH(ctxt->nodes[exid], ctxt, transformedRay, t_min, t_max, &isectTmp)) {
+		if (intersectBVH(ctxt->nodes[c.exid], ctxt, transformedRay, t_min, t_max, &isectTmp)) {
 			if (isectTmp.t < isect->t) {
 				*isect = isectTmp;
 				isHit = true;

						isectTmp.mtrlid = s->mtrl.idx;
					}

					if (isectTmp.t < hitt) {
						hitt = isectTmp.t;
						*exid = tmpexid;
						*shapeid = tmpshapeid;

						if (tmpshapeid >= 0 && type == IntersectType::Closer) {
							return false;
						}
					}
					if (tmpexid < 0) {

	real hitt = t_max;
	isect->t = t_max;

	int tmpexid = -1;

	int tmpshapeid = -1;

	int nodeid = -1;
