Bugfixed xcdatamodeld group detection
diff --git a/lib/pbxFile.js b/lib/pbxFile.js
index 112d5cd..c53b1ab 100644
--- a/lib/pbxFile.js
+++ b/lib/pbxFile.js
@@ -94,7 +94,7 @@
 }
 
 function detectGroup(fileRef) {
-    var extension = path.extname(this.basename).substring(1),
+    var extension = path.extname(fileRef.basename).substring(1),
         filetype = fileRef.lastKnownFileType || fileRef.explicitFileType,
         groupName = GROUP_BY_FILETYPE[unquoted(filetype)];
 
@@ -159,6 +159,7 @@
     
     self = this;
 
+    this.basename = path.basename(filepath);
     this.lastKnownFileType = opt.lastKnownFileType || detectType(filepath);
     this.group = detectGroup(self);
 
@@ -168,7 +169,6 @@
         this.dirname = path.dirname(filepath);
     }
 
-    this.basename = path.basename(filepath);
     this.path = defaultPath(this, filepath);
     this.fileEncoding = this.defaultEncoding = opt.defaultEncoding || defaultEncoding(self);