Problem setting .NET member variables

Hello, can anyone help me with this issue? I have the following code
running in C#:

ScriptRuntime runtime = Ruby.CreateRuntime();
ScriptEngine engine = Ruby.GetEngine(runtime);
ScriptScope scope = runtime.CreateScope();
scope.SetVariable(“model”, model);
StreamReader sr = new
StreamReader(ConfigurationManager.AppSettings[“RubyFlagsPath”] +
flagName + “.rb”);
string rubyScript = sr.ReadToEnd();
engine.Execute(rubyScript, scope);

which runs this Ruby code in part:

model.Transaction.Runs[0].RunLoan.RunBorrowers[2].RunLoan.RunFlagTestResults[0].Passed
= false
model.Transaction.Runs[0].RunLoan.RunBorrowers[3].RunLoan.RunFlagTestResults[0].Passed
= true

f.syswrite(“passed3
#{model.Transaction.Runs[0].RunLoan.RunBorrowers[2].RunLoan.RunFlagTestResults[0].Passed}
\n”)
f.syswrite(“passed4
#{model.Transaction.Runs[0].RunLoan.RunBorrowers[3].RunLoan.RunFlagTestResults[0].Passed}
\n”)

The output I get is the following:

true
true

Obviously something is not quite right, the results should have been
false, true. Now, I’ve tried this with up to four borrowers and each
time the consistent pattern I’m seeing is that whatever I set the last
passed status to is set for ALL the borrowers. Somehow Ruby is setting
the passed status for all borrowers at once with each call, even though
they are in completely different objects.

I believe this was an internal object reference issue - in .NET, not in
Ruby. thanks!