Added code to prevent contour crashing...