update function countNode