Merge pull request #1645 from mxfm/b9438

Fix issue 9438 - Strange RefCounted stack overflow