chdir had to happen within the Stat class