Fixes bugs for plugin loading