I remember seeing something on this and I think you need to make the OIR "aware" of the IBA(s) that you are using with VarDef and then using the value with VarRef. Look in the Help Center under Syntax for Algorithm Arguments.
I have not used myself, so can not help you much beyond that. I was trying to use "temporary" values rather than IBA's and never figured out how.