Fixing a few bugs in the plugin system