A.3.1.1 ctx.set_value()

Fixed handling of tree iterator backdoor and improved error reporting.