fixed to use chdir