Robust chdir