Fix plugin add/remove

*Fix #504