This is a classic example of why naked pointers suck! The right way to fix an interdependency would be to have these objects hold onto weak references to each other. But that's way too big a change at this point in time, so I've added this ugly hack instead. This will fix an intermittent crash when either accessing the library or exiting a match.