diff --git a/src/python.c b/src/python.c
index ee67388..132e8e7 100644
--- a/src/python.c
+++ b/src/python.c
@@ -980,8 +980,10 @@ static int cpy_config(oconfig_item_t *ci) {
 	int i;
 	char *argv = "";
 	PyObject *sys, *tb;
-	PyObject *sys_path;
+	PyObject *sys_path = NULL;
 	PyObject *module;
+
+	if (!Py_IsInitialized()) {
 	
 	/* Ok in theory we shouldn't do initialization at this point
 	 * but we have to. In order to give python scripts a chance
@@ -1039,6 +1041,8 @@ static int cpy_config(oconfig_item_t *ci) {
 	PyModule_AddIntConstant(module, "NOTIF_FAILURE", NOTIF_FAILURE);
 	PyModule_AddIntConstant(module, "NOTIF_WARNING", NOTIF_WARNING);
 	PyModule_AddIntConstant(module, "NOTIF_OKAY", NOTIF_OKAY);
+	}
+
 	for (i = 0; i < ci->children_num; ++i) {
 		oconfig_item_t *item = ci->children + i;
 		
@@ -1072,6 +1076,10 @@ static int cpy_config(oconfig_item_t *ci) {
 			if (cpy_format_exception == NULL)
 				cpy_log_exception("python initialization");
 		} else if (strcasecmp(item->key, "ModulePath") == 0) {
+			if (sys_path == NULL) {
+				ERROR("python plugin: ModulePath must be in the first <Plugin python> block");
+				continue;
+			}
 			char *dir = NULL;
 			PyObject *dir_object;
 			
@@ -1138,7 +1146,7 @@ static int cpy_config(oconfig_item_t *ci) {
 			WARNING("python plugin: Ignoring unknown config key \"%s\".", item->key);
 		}
 	}
-	Py_DECREF(sys_path);
+	if (sys_path != NULL) Py_DECREF(sys_path);
 	return 0;
 }
 
