chdir earlier