insures links are present before running foreach on it
fixed extra link addition
Merge branch '1.8.1'