fixed bug with chdir