fix chdir not resetting