avoid infinite loops while stitching holes