PluginLoader: fix build warning
Fix document cloning and rebuilding