Core fix: unregistering plugin listeners (#686).

See #686.