diff --git a/storage/connect/ha_connect.cc b/storage/connect/ha_connect.cc
index 1f5aff609c1..903b4ec1f92 100644
--- a/storage/connect/ha_connect.cc
+++ b/storage/connect/ha_connect.cc
@@ -237,7 +237,7 @@ extern "C" const char *msglang(void);
 
 static void PopUser(PCONNECT xp);
 static PCONNECT GetUser(THD *thd, PCONNECT xp);
-static PGLOBAL  GetPlug(THD *thd, PCONNECT& lxp);
+//static PGLOBAL  GetPlug(THD *thd, PCONNECT lxp);
 
 static handler *connect_create_handler(handlerton *hton,
                                        TABLE_SHARE *table,
@@ -950,11 +950,11 @@ static PCONNECT GetUser(THD *thd, PCONNECT xp)
 /****************************************************************************/
 /*  Get the global pointer of the user of this handler.                     */
 /****************************************************************************/
-static PGLOBAL GetPlug(THD *thd, PCONNECT& lxp)
-{
-  lxp= GetUser(thd, lxp);
-  return (lxp) ? lxp->g : NULL;
-} // end of GetPlug
+//static PGLOBAL GetPlug(THD *thd, PCONNECT lxp)
+//{
+//  PCONNECT nxp= GetUser(thd, lxp);
+//  return (nxp) ? nxp->g : NULL;
+//} // end of GetPlug
 
 /****************************************************************************/
 /*  Get the implied table type.                                             */
@@ -1529,8 +1529,9 @@ void *ha_connect::GetColumnOption(PGLOBAL g, void *field, PCOLINFO pcf)
         if (pcf->Datefmt) {
           // Find the (max) length produced by the date format
           char    buf[256];
-          PGLOBAL g= GetPlug(table->in_use, xp);
-          PDTP    pdtp= MakeDateFormat(g, pcf->Datefmt, false, true, 0);
+//        PGLOBAL g= GetPlug(table->in_use, xp);
+					DBUG_ASSERT(xp && xp->thdp == ha_thd());
+					PDTP    pdtp= MakeDateFormat(xp->g, pcf->Datefmt, false, true, 0);
           struct tm datm;
           bzero(&datm, sizeof(datm));
           datm.tm_mday= 12;
@@ -3868,8 +3869,10 @@ int ha_connect::index_next_same(uchar *buf, const uchar *, uint)
 */
 int ha_connect::rnd_init(bool scan)
 {
-  PGLOBAL g= ((table && table->in_use) ? GetPlug(table->in_use, xp) :
-              (xp) ? xp->g : NULL);
+  //PGLOBAL g= ((table && table->in_use) ? GetPlug(table->in_use, xp) :
+  //            (xp) ? xp->g : NULL);
+	DBUG_ASSERT(xp && xp->thdp == ha_thd());
+	PGLOBAL g= xp->g;
   DBUG_ENTER("ha_connect::rnd_init");
 
   // This is not tested yet
@@ -4064,9 +4067,10 @@ int ha_connect::rnd_pos(uchar *buf, uchar *pos)
     tdbp->SetFilter(NULL);
     rc= rnd_next(buf);
 	} else {
-		PGLOBAL g = GetPlug((table) ? table->in_use : NULL, xp);
-		strcpy(g->Message, "Not supported by this table type");
-		my_message(ER_ILLEGAL_HA, g->Message, MYF(0));
+//	PGLOBAL g = GetPlug((table) ? table->in_use : NULL, xp);
+		DBUG_ASSERT(xp && xp->thdp == ha_thd());
+		strcpy(xp->g->Message, "Not supported by this table type");
+		my_message(ER_ILLEGAL_HA, xp->g->Message, MYF(0));
 		rc= HA_ERR_INTERNAL_ERROR;
 	}	// endif SetRecpos
 
@@ -4115,7 +4119,10 @@ int ha_connect::rnd_pos(uchar *buf, uchar *pos)
 int ha_connect::info(uint flag)
 {
   bool    pure= false;
-  PGLOBAL g= GetPlug((table) ? table->in_use : NULL, xp);
+  //PGLOBAL g= GetPlug((table) ? table->in_use : NULL, xp);
+	//xp= GetUser((table) ? table->in_use : NULL, xp);		// Usefull ???
+	DBUG_ASSERT(xp && xp->thdp == ha_thd());
+	PGLOBAL g= xp->g;
 
   DBUG_ENTER("ha_connect::info");
 
@@ -4533,7 +4540,9 @@ int ha_connect::start_stmt(THD *thd, thr_lock_type lock_type)
   int     rc= 0;
   bool    chk=false, cras= false;
   MODE    newmode;
-  PGLOBAL g= GetPlug(thd, xp);
+//PGLOBAL g= GetPlug(thd, xp);
+	xp = GetUser(thd, xp);
+	PGLOBAL g= xp->g;
   DBUG_ENTER("ha_connect::start_stmt");
 
   if (check_privileges(thd, GetTableOptionStruct(), table->s->db.str, true))
@@ -4595,8 +4604,10 @@ int ha_connect::external_lock(THD *thd, int lock_type)
   bool    xcheck=false, cras= false;
   MODE    newmode;
   PTOS    options= GetTableOptionStruct();
-  PGLOBAL g= GetPlug(thd, xp);
-  DBUG_ENTER("ha_connect::external_lock");
+	//PGLOBAL g= GetPlug(thd, xp);
+	xp= GetUser(thd, xp);
+	PGLOBAL g= xp->g;
+	DBUG_ENTER("ha_connect::external_lock");
 
   DBUG_ASSERT(thd == current_thd);
 
@@ -5376,8 +5387,8 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
   TABTYPE  ttp= TAB_UNDEF;
   PQRYRES  qrp= NULL;
   PCOLRES  crp;
-  PCONNECT xp= NULL;
-  PGLOBAL  g= GetPlug(thd, xp);
+  PCONNECT xp= GetUser(thd, NULL);
+  PGLOBAL  g= xp->g;
 
 	if (!g)
 		return HA_ERR_INTERNAL_ERROR;
@@ -6130,8 +6141,8 @@ int ha_connect::create(const char *name, TABLE *table_arg,
 #if defined(WITH_PARTITION_STORAGE_ENGINE)
   partition_info *part_info= table_arg->part_info;
 #endif   // WITH_PARTITION_STORAGE_ENGINE
-  xp= GetUser(thd, xp);
-  PGLOBAL g= xp->g;
+	xp= GetUser(thd, xp);
+	PGLOBAL g= xp->g;
 
   DBUG_ENTER("ha_connect::create");
   /*
@@ -6719,7 +6730,7 @@ bool ha_connect::FileExists(const char *fn, bool bf)
 } // end of FileExists
 
 // Called by SameString and NoFieldOptionChange
-bool ha_connect::CheckString(const char *str1, const char *str2)
+bool ha_connect::CheckString(PCSZ str1, PCSZ str2)
 {
   bool  b1= (!str1 || !*str1), b2= (!str2 || !*str2);
 
diff --git a/storage/connect/ha_connect.h b/storage/connect/ha_connect.h
index 9d71aaa5433..a5dcd4f65f1 100644
--- a/storage/connect/ha_connect.h
+++ b/storage/connect/ha_connect.h
@@ -166,8 +166,8 @@ public:
   ~ha_connect();
 
   // CONNECT Implementation
-  static   bool connect_init(void);
-  static   bool connect_end(void);
+//static   bool connect_init(void);
+//static   bool connect_end(void);
   TABTYPE  GetRealType(PTOS pos= NULL);
   char    *GetRealString(PCSZ s);
 	PCSZ     GetStringOption(PCSZ opname, PCSZ sdef= NULL);
diff --git a/storage/connect/plugutil.cpp b/storage/connect/plugutil.cpp
index d3d7bd1a06d..d63674e2e36 100644
--- a/storage/connect/plugutil.cpp
+++ b/storage/connect/plugutil.cpp
@@ -185,7 +185,7 @@ int PlugExit(PGLOBAL g)
 
 		if (g->Sarea) {
 #if !defined(DEVELOPMENT)
-			if (trace) {
+			if (trace)
 #endif
 				htrc("Freeing Sarea at %p size=%d\n", g->Sarea, g->Sarea_Size);