Removed dependencies on getPlugin and changed the order of deactivation of plugins.