Fixed some raytrace bugs