Fix a minor bug in writeNode() method

If a tree handle is used for both read and write, writer offset
position corrupts the tree writes.
Fix a logical bug in modify API