Updated pre-install to prefer PWD but fall back to getcwd() if needed