proper exit when node is detected