Never change working directory. Use relative or abs paths instead, with pref given to rel paths.