Added more state/sensor checks when a node is defined.