diff --git a/python/ldtpeditor b/python/ldtpeditor
index 7c49e39..14e92a9 100755
--- a/python/ldtpeditor
+++ b/python/ldtpeditor
@@ -342,11 +342,16 @@ class LdtpEditorGui (gnome.Program):
                             data = code [2][re.search ('\w+', code [2]).start () : len (code [2]) - 2]
                             lines = '%s\t%s = xmlParser.gettagvalue (\"%s\")\n' \
                                     % (lines, component, component)
+                            if self.chkGenerateOoldtp == True and line.strip() != '' \
+                                    and re.match ('wait\s', line) == None:
+                                lines = '%s\t%s\"%s\", %s [0])\n' \
+                                        % (lines, ldtplib.libldtpcodegen.objectOrient (code [0]), component, component)
+                            else:
                             lines = '%s\t%s, \"%s\", %s [0])\n' \
                                     % (lines, code [0], component, component) 
                             xml = '%s<%s>%s</%s>\n' % (xml, component, saxutils.escape (data), component)
                             continue
-                    if self.chkGenerateOoldtp == True and line.strip() != '' and re.match ('wait', line) == None:
+                    if self.chkGenerateOoldtp == True and line.strip() != '' and re.match ('wait\s', line) == None:
                         line = ldtplib.libldtpcodegen.objectOrient (line)
                     lines = '%s\t%s\n' % (lines, line)
                 #lines += '\n\tlog (\"test script\", \"pass\")\n'
diff --git a/python/ldtplib/libldtpcodegen.py b/python/ldtplib/libldtpcodegen.py
index 5616150..35b61c9 100644
--- a/python/ldtplib/libldtpcodegen.py
+++ b/python/ldtplib/libldtpcodegen.py
@@ -48,7 +48,7 @@ APPHOME = "%s/.ldtp" % os.environ['HOME']
 APPROOT = "/usr/share/ldtp"
 
 #ooldtp support Global
-context = []
+contextList = []
 
 # Let us not register our application under at-spi application list
 os.environ ['GTK_MODULES'] = ''
@@ -668,7 +668,6 @@ def getapps ():
 def wildcard (str):
     global appList
     if len (appList) == 0:
-        print "Reading Data from file"
         appList = getapps ()
     for item in appList:
         regex= '\"\S*?%s\S*?\"' % item
@@ -691,24 +690,29 @@ def saveAppList (newAppList):
 
 #oldtp support specific function... initContext
 def initContext():
-    global context
-    context = []
+    global contextList
+    contextList = []
 
 #ooldtp support specific function... objectOrient
 def objectOrient (line):
-    global context
+    global contextList
     re1 = re.compile ('\".*?\"')
-    shrink = re1.findall(line)[0]
+    shrink = re1.findall (line)[0]
+    re3 = re.compile ('\W|^\d*')
+    context = re3.sub ('', shrink)
     re2 = re.compile ('\".*?\"\,\s')
+    if re2.search (line) != None:
     parts = re2.split (line, 1)
-    for all in context:
-        if all == shrink:
-            line = 'context%d.%s%s' % (context.index(all), parts[0], parts[1])
+    else:
+        parts = re1.split (line, 1)
+    for all in contextList:
+        if all == context:
+            line = '%s.%s%s' % (context, parts[0], parts[1])
             return line
-    context.append (shrink)
-    last = len(context) - 1
-    line = 'context%d = context(%s)\n\t' % (last, shrink)
-    line = '%scontext%d.%s%s' % (line, last, parts[0], parts[1])
+    contextList.append (context)
+    #last = len(context) - 1
+    line = '%s = context(%s)\n\t' % (context, shrink)
+    line = '%s%s.%s%s' % (line, context, parts[0], parts[1])
     return line
 
 def callback (guiCallbackFunc, data, timeElapsed = None):
