Fix incomplete commit for automatic heter-node detection and add some debug