added check to be sure urls are valid before making the link