mov preparePlugins(), shutdowPlugins() to right place