Fixed linking issues on re-run of script. Permissions on x files for Soma