Fixing linking recursion problems and PWD cross platform issues.