modify the method to extract boundary in optimalCurve.m   Also, turn off warning as needed