// Initialize eVaf plugins
     i = 0;
     while (i < mPlugins.size()) {
-        if (mPlugins.at(i)->init()) {
+        if (!mPlugins.at(i)->init()) {
             EVAF_ERROR("Failed to initialize module '%s'", qPrintable(mPlugins.at(i)->name()));
             mPlugins.removeAt(i);
         }
 
 Module::~Module()
 {
-    if (mPluginFactory)
-        delete mPluginFactory;
-    if (mLoader)
+    if (mLoader) {
+        mLoader->unload();
         delete mLoader;
+    }
 }
 
 bool Module::load()
     if ((mPluginFactory = qobject_cast<iPluginFactory *>(root)) == 0) {
 
         // If not, then it has to implement the iPlugin interface
-        if ((mPlugin = qobject_cast<iPlugin *>(root)) == 0) {
+        if (qobject_cast<iPlugin *>(root) == 0) {
             EVAF_FATAL_ERROR("Module '%s' is not a valid eVaf module", qPrintable(mName));
             return false;
         }
 void Module::unload()
 {
     mRoot = 0;
-
-    if (mPluginFactory) {
-        delete mPluginFactory;
-        mPluginFactory = 0;
-    }
+    mPluginFactory = 0;
     mPlugin = 0;
     if (mLoader) {
+        mLoader->unload();
         delete mLoader;
         mLoader = 0;
     }
 
 Plugin::~Plugin()
 {
-    if (mPlugin)
-        delete mPlugin;
 }
 
 bool Plugin::load()
 
 void Plugin::unload()
 {
-    if (mPlugin) {
-        delete mPlugin;
-        mPlugin = 0;
-    }
+    mPlugin = 0;
 }
 
 bool Plugin::init()
 
 /**
  * Module/library version number in the form major,minor,release,build
  */
-#define VER_FILE_VERSION                0,1,1,1
+#define VER_FILE_VERSION                0,1,1,2
 
 /**
  * Module/library version number in the string format (shall end with \0)
  */
-#define VER_FILE_VERSION_STR            "0.1.1.1\0"
+#define VER_FILE_VERSION_STR            "0.1.1.2\0"
 
 /**
  * Module/library name (shall end with \0)