detect when node is removed