Move a check in compute_distance2outer to earlier