changed unload path to not segfault if a plugin is NULL at unload #327