Fixed error reporting in plugin loading/unloading