Fixing logic errors in HandlePluginResult