Fix bug with insertOrReplace
Fix bug with insertOrReplace

A node that was going to be replaced did not get it's inputs linked
properly. This commit fixes this issue.

ninjadev/nin,ninjadev/nin,ninjadev/nin