Fixed #111 -- move new_nodes out of conditional and delete nodes properly.
Merge pull request #116 from opdemand/111-scaling-error

Fixed #111 -- move new_nodes out of conditional and delete nodes properly