--- a/game.cpp
+++ b/game.cpp
@@ -25,13 +25,14 @@
   pcs=NULL;
   variables=NULL;
   unknowns1=NULL;
-  unknowns2=NULL;
+  mazedata=NULL;
   journals=NULL;
   npcextensions=NULL;
   npcstructs=NULL;
   pcstructs=NULL;
   pcextensions=NULL;
   deathvariables=NULL;
+  slocs=NULL;
 
   npccount=0;
   pccount=0;
@@ -41,9 +42,10 @@
   pcextensioncount=0;
   variablecount=0;
   unknown1count=0;
-  unknown2count=0;
   journalcount=0;
   deathvariablecount=0;
+  sloccount=0;
+
   revision=20; //bg2 revision is 2.0
 }
 
@@ -57,8 +59,9 @@
   KillPCExtensions();
   KillNPCExtensions();
   KillUnknowns1();
-  KillUnknowns2();
+  KillMazeData();
   KillJournals();
+  KillSavedLocs();
   KillDeathVariables();
 }
 
@@ -212,8 +215,8 @@
   fullsize+=header.variablecount*sizeof(gam_variable);
   if(revision==12)
   {
-    pstheader.unknown2offset=fullsize;
-    fullsize+=sizeof(gam_unknown2);
+    pstheader.mazeoffset=fullsize;
+    fullsize+=sizeof(gam_mazedata);
     pstheader.dvaroffset=fullsize;
     fullsize+=header.dvarcount*sizeof(gam_variable);
   }
@@ -240,6 +243,8 @@
     }
     if(revision==22) fullsize+=4;
   }
+  header.slocoffset=fullsize;
+  fullsize+=header.sloccount*sizeof(gam_sloc);
 
   if(calculate)
   {
@@ -306,7 +311,7 @@
   }
   if(revision==12)
   {
-    if(write(fhandle,unknowns2,sizeof(gam_unknown2) )!=sizeof(gam_unknown2) )
+    if(write(fhandle,mazedata,sizeof(gam_mazedata) )!=sizeof(gam_mazedata) )
     {
       return -2;
     }
@@ -354,6 +359,11 @@
     {
       write(fhandle,familiardata,4);
     }
+  }
+  esize=header.sloccount*sizeof(gam_sloc);
+  if(write(fhandle,variables,esize)!=esize)
+  {
+    return -2;
   }
   return 0;
 }
@@ -453,6 +463,59 @@
       }      
     }
   }
+
+  //read pcs
+  flg=adjust_actpoint(header.pcoffset);
+  if(flg<0)
+  {
+    return flg;
+  }
+  if(flg) ret|=flg;
+
+  if(pccount!=header.pccount)
+  {
+    KillPCs();
+    pcs=new gam_npc[header.pccount];
+    if(!pcs) return -3;
+    pccount=header.pccount;
+  }
+  if(pccount!=pcstructcount)
+  {
+    KillPCStructs();
+    pcstructs=new char *[pccount];
+    if(!pcstructs)
+    {
+      return -3;
+    }
+    memset(pcstructs,0,pccount*sizeof(char *) );
+    pcstructcount=pccount;
+  }
+  if(pccount!=pcextensioncount)
+  {
+    KillPCExtensions();
+    pcextensions=new gam_npc_extension[pccount];
+    if(!pcextensions)
+    {
+      return -3;
+    }
+    memset(pcextensions,0,pccount*sizeof(gam_npc_extension) );
+    pcextensioncount=pccount;
+  }
+
+  for(i=0;i<pccount;i++)
+  {
+    esize=sizeof(gam_npc);
+    if(read(fhandle,pcs+i, esize)!=esize)
+    {
+      return -2;
+    }
+    fullsize+=esize;
+    flg=ReadExtension((char *) (pcextensions+i),fullsize, mysize);
+    if(flg<0) return flg;
+    flg=ReadCreData(pcs[i].creoffset, pcs[i].cresize,pcstructs[i],fullsize);
+    if(flg<0) return flg;
+  }
+
   //read non-party npcs
   flg=adjust_actpoint(header.npcoffset);
   if(flg<0)
@@ -505,58 +568,6 @@
     if(flg<0) return flg;
  }
 
-  //read pcs
-  flg=adjust_actpoint(header.pcoffset);
-  if(flg<0)
-  {
-    return flg;
-  }
-  if(flg) ret|=flg;
-
-  if(pccount!=header.pccount)
-  {
-    KillPCs();
-    pcs=new gam_npc[header.pccount];
-    if(!pcs) return -3;
-    pccount=header.pccount;
-  }
-  if(pccount!=pcstructcount)
-  {
-    KillPCStructs();
-    pcstructs=new char *[pccount];
-    if(!pcstructs)
-    {
-      return -3;
-    }
-    memset(pcstructs,0,pccount*sizeof(char *) );
-    pcstructcount=pccount;
-  }
-  if(pccount!=pcextensioncount)
-  {
-    KillPCExtensions();
-    pcextensions=new gam_npc_extension[pccount];
-    if(!pcextensions)
-    {
-      return -3;
-    }
-    memset(pcextensions,0,pccount*sizeof(gam_npc_extension) );
-    pcextensioncount=pccount;
-  }
-
-  for(i=0;i<pccount;i++)
-  {
-    esize=sizeof(gam_npc);
-    if(read(fhandle,pcs+i, esize)!=esize)
-    {
-      return -2;
-    }
-    fullsize+=esize;
-    flg=ReadExtension((char *) (pcextensions+i),fullsize, mysize);
-    if(flg<0) return flg;
-    flg=ReadCreData(pcs[i].creoffset, pcs[i].cresize,pcstructs[i],fullsize);
-    if(flg<0) return flg;
-  }
-
   //read unknownstruct
   flg=adjust_actpoint(header.unknown1offset);
   if(flg<0)
@@ -601,24 +612,23 @@
 
   if(revision==12)
   {
-    //read unknownstruct (only in pst), hack!
-    flg=adjust_actpoint(pstheader.unknown2offset);
+    //read maze data (only in pst)
+    flg=adjust_actpoint(pstheader.mazeoffset);
     if(flg<0)
     {
       return flg;
     }
     if(flg) ret|=flg;
     
-    if(unknown2count!=1)
-    {
-      KillUnknowns2();
-      unknowns2=new gam_unknown2[1];
-      if(!unknowns2) return -3;
-      unknown2count=1;
+    if(!mazedata)
+    {
+      KillMazeData();
+      mazedata=new gam_mazedata;
+      if(!mazedata) return -3;
     }
     
-    esize=sizeof(gam_unknown2)*1;
-    if(read(fhandle,unknowns2, esize)!=esize)
+    esize=sizeof(gam_mazedata);
+    if(read(fhandle,mazedata, esize)!=esize)
     {
       return -2;
     }
@@ -700,6 +710,30 @@
     fullsize+=esize;
   }
   else memset(&familiar,0,sizeof(familiar) );
+
+  if(revision==20)
+  {
+    flg=adjust_actpoint(header.slocoffset);
+    if(flg<0)
+    {
+      return flg;
+    }
+    if(flg) ret|=flg;
+
+    if(sloccount!=header.sloccount)
+    {
+      KillSavedLocs();
+      slocs = new gam_sloc[header.sloccount];
+      if(!slocs) return -3;
+      sloccount=header.sloccount;
+    }
+    esize =sizeof(gam_sloc)*header.sloccount;
+    if(read(fhandle,slocs, esize)!=esize)
+    {
+      return -2;
+    }
+    fullsize+=esize;
+  }
   if(revision==22) //this is a hack for iwd2
   {
     fullsize+=4;