fix the linking script to remove existing files before linking