fix failed node ID counter. flush stdout when logging