fixed replace for undo

undo now properly reverts a single input node to a node with more
inputs that it had replaced