upgrade link_file function to work with existing links