fixed a check for node not being NULL.