Keep a reference to the correct associated context of the reference function and use that context when calling the reference function.