I had a similar problem on really old *nixes, where I had to suck in setups to run in various production environments. The old *nix couldn't take path variables over some limit, and would just chop it off, leaving only part of the necessary path, and a useless dangling root tip.
I had to save off the original path, suck in the new stuff, then cut out duplicates and other known useless bits, and set the path with the new shorter string. I think I just used a Perl script as a filter in backquotes in the shell, and all was (mostly) well...until I tried tcsh, but that's another story.
Quantum Mechanics: The dreams stuff is made of