debugging refraction