Fix the plugin that use the document and window objects.