added code for the case of no intersection with bezier