Fix a bug in compute_distance2boundary