 			  ref2d += tc.xy; // use as offset from destination
 
 			  if (ref2d.y < 0.0 || ref2d.y > screen_res.y ||
-			      ref2d.x < 0.0 || ref2d.x > screen_res.x) break;
+			      ref2d.x < 0.0 || ref2d.x > screen_res.x) continue;
 
 			  // Get attributes from the 2D guess point.
 			  float refdepth = texture2DRect(depthMap, ref2d).r;

			  // figure out how appropriate our guess actually was, directionwise
			  //float refapprop=1;
			  //float refapprop = max(0.0, dot(refnorm, normalize(refpos - pos)));
			  float refapprop = 1.0 - rdpow2;
			  if (refdepth < 1.0) { // non-sky
			    //refapprop *= step(0.0, dot(refnorm, (refpos - pos)));
			    refapprop *= max(0.0, dot(refnorm, normalize(refpos - pos)));
			    //refapprop *= (1.0 - sqrt(rdpow2));
			    float refshad = texture2DRect(lightMap, ref2d).r;
			    refshad = pow(refshad, light_gamma);
			    vec3 refn = decode_normal(texture2DRect(normalMap, ref2d).xy);
			    // darken reflections from points which face away from the reflected ray - our guess was a back-face
			    //refapprop *= step(dot(refnorm, refn), 0.0);
			    refapprop = max(min(refapprop, -dot(refnorm, refn)), 0.0);
			    //refapprop = min(refapprop, max(0.0, -dot(refnorm, refn))); // more conservative variant
			    // kill guesses which are 'behind' the reflector
			    float ppdist = dot(norm.xyz, refpos.xyz - pos.xyz);

		col *= diffuse.rgb;
	
		vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz));
//spec.rgba = max(spec.rgba, vec4(1.0, 1.0, 1.0, 0.95));
		if (spec.a > 0.0) // specular reflection
		{
		  			// the old infinite-sky shiny reflection
