tweaked file link function