Fix crash in PluginManager