diff --git a/io_coat3D/coat.py b/io_coat3D/coat.py
index ce04ac798968c8026203ff8747ee539dd4544b2c..51ed930f5ef11707f4b8e7a8438916dce5a970ac 100644
--- a/io_coat3D/coat.py
+++ b/io_coat3D/coat.py
@@ -456,7 +456,10 @@ class SCENE_OT_deltex(bpy.types.Operator):
         coa = bpy.context.scene.objects.active.coat3D
         scene = context.scene
         nimi = tex.objname(coa.objectdir)
-        osoite = os.path.dirname(coa.objectdir) + os.sep
+        if(coa.texturefolder):
+            osoite = os.path.dirname(coa.texturefolder) + os.sep
+        else:
+            osoite = os.path.dirname(coa.objectdir) + os.sep
         just_nimi = tex.justname(nimi)
         just_nimi += '_'