Buf fix for termination code for more than 2 nodes