Fix bugs of contour plugin