remove node before replacing