fix bug which triggers assert if files are linked in a particular order