minor changes to ensure that fctx reference counting is clear and correct. (cherry picked from commit d2f407cca3)
d2f407cca3