Fix node-removal code