Add some error handling to PluginManager