Fixing functionality of traceRay() and saveImage().