fix chdir inside chdir warning will make exit code not 0