fixed null reference exception by checking if node and first child are not null before getting the value of the node;