[BUG] Set the cost function to 0 if there are no intersections