fix the exception when no nodes avaiable