insures links are present before running foreach on it