diff -Naur yadex-1.7.0/GNUmakefile yadex-1.7.0.new/GNUmakefile
--- yadex-1.7.0/GNUmakefile	2006-03-16 20:33:36.000000000 -0800
+++ yadex-1.7.0.new/GNUmakefile	2006-03-16 18:37:50.000000000 -0800
@@ -53,6 +53,7 @@
 
 # Which OS ?
 OS := $(shell uname -s | tr A-Z a-z)
+ARCH := $(shell uname -i | tr A-Z a-z)
 
 # Where your X11 libraries and headers reside.
 # Current rule:
@@ -67,7 +68,11 @@
     X11LIBDIR     = /usr/openwin/lib
     X11INCLUDEDIR = /usr/openwin/include
   else
-    X11LIBDIR     = /usr/X11R6/lib
+    ifeq ($(findstring $(ARCH), x86_64), $(ARCH))
+        X11LIBDIR     = /usr/X11R6/lib64
+    else
+        X11LIBDIR     = /usr/X11R6/lib
+    endif
     X11INCLUDEDIR = /usr/X11R6/include
   endif
 endif
diff -Naur yadex-1.7.0/src/levels.cc yadex-1.7.0.new/src/levels.cc
--- yadex-1.7.0/src/levels.cc	2003-03-28 04:37:32.000000000 -0800
+++ yadex-1.7.0.new/src/levels.cc	2006-03-16 20:38:01.000000000 -0800
@@ -1387,7 +1387,7 @@
       }
    NumWTexture = (int) val + 1;
    /* read in the offsets for texture1 names */
-   offsets = (i32 *) GetMemory ((long) NumWTexture * 4);
+   offsets = (i32 *) GetMemory ((long) NumWTexture * (sizeof(i32)));
    wf->read_i32 (offsets + 1, NumWTexture - 1);
    if (wf->error ())
       {
@@ -1445,7 +1445,7 @@
       }
       NumWTexture = (int) val + 1;
       /* read in the offsets for texture1 names */
-      offsets = (i32 *) GetMemory ((long) NumWTexture * 4);
+      offsets = (i32 *) GetMemory ((long) NumWTexture * sizeof(i32));
       wf->read_i32 (offsets + 1, NumWTexture - 1);
       {
 	// FIXME
@@ -1489,7 +1489,7 @@
 	// FIXME
       }
       /* read in the offsets for texture2 names */
-      offsets = (i32 *) GetMemory ((long) val * 4);
+      offsets = (i32 *) GetMemory ((long) val * sizeof(i32));
       wf->read_i32 (offsets, val);
       if (wf->error ())
       {
diff -Naur yadex-1.7.0/src/pic2img.cc yadex-1.7.0.new/src/pic2img.cc
--- yadex-1.7.0/src/pic2img.cc	2003-03-28 04:37:32.000000000 -0800
+++ yadex-1.7.0.new/src/pic2img.cc	2006-03-16 20:30:40.000000000 -0800
@@ -192,7 +192,7 @@
 
 ColumnData    = (u8 *) GetMemory (TEX_COLUMNBUFFERSIZE);
 /* FIXME DOS and pic_width_ > 16000 */
-NeededOffsets = (i32 *) GetMemory ((long) pic_width_ * 4);
+NeededOffsets = (i32 *) GetMemory ((long) pic_width_ * (sizeof(i32)));
 
 if (long_offsets)
    dir->wadfile->read_i32 (NeededOffsets, pic_width_);
diff -Naur yadex-1.7.0/src/r_images.cc yadex-1.7.0.new/src/r_images.cc
--- yadex-1.7.0/src/r_images.cc	2006-03-16 20:33:12.000000000 -0800
+++ yadex-1.7.0.new/src/r_images.cc	2006-03-16 20:39:17.000000000 -0800
@@ -182,7 +182,7 @@
       dir->wadfile->seek (dir->dir.start);
       dir->wadfile->read_i32 (&numtex);
       /* read in the offsets for texture1 names and info. */
-      offsets = (i32 *) GetMemory ((long) numtex * 4);
+      offsets = (i32 *) GetMemory ((long) numtex * sizeof(i32));
       dir->wadfile->read_i32 (offsets, numtex);
       for (n = 0; n < numtex && !texofs; n++)
          {
@@ -205,7 +205,7 @@
       dir->wadfile->seek (dir->dir.start);
       dir->wadfile->read_i32 (&numtex);
       /* read in the offsets for texture1 names and info. */
-      offsets = (i32 *) GetMemory ((long) numtex * 4);
+      offsets = (i32 *) GetMemory ((long) numtex * sizeof(i32));
       dir->wadfile->read_i32 (offsets, numtex);
       for (n = 0; n < numtex && !texofs; n++)
          {
@@ -225,7 +225,7 @@
          dir->wadfile->seek (dir->dir.start);
          dir->wadfile->read_i32 (&numtex);
          /* read in the offsets for texture2 names */
-         offsets = (i32 *) GetMemory ((long) numtex * 4);
+         offsets = (i32 *) GetMemory ((long) numtex * sizeof(i32));
          dir->wadfile->read_i32 (offsets, numtex);
          for (n = 0; n < numtex && !texofs; n++)
             {
diff -Naur yadex-1.7.0/src/textures.cc yadex-1.7.0.new/src/textures.cc
--- yadex-1.7.0/src/textures.cc	2003-04-24 13:50:36.000000000 -0700
+++ yadex-1.7.0.new/src/textures.cc	2006-03-16 20:38:44.000000000 -0800
@@ -177,7 +177,7 @@
 	 goto textures_done;
 	 }
       // Read in the offsets for texture1 names and info
-      offsets = (i32 *) GetMemory ((long) numtex * 4);
+      offsets = (i32 *) GetMemory ((long) numtex * sizeof(i32));
       wf->read_i32 (offsets, numtex);
       if (wf->error ())
 	 {
@@ -233,7 +233,7 @@
 	 goto texture1_done;
 	 }
       // Read in the offsets for texture1 names and info
-      offsets = (i32 *) GetMemory ((long) numtex * 4);
+      offsets = (i32 *) GetMemory ((long) numtex * sizeof(i32));
       wf->read_i32 (offsets, numtex);
       if (wf->error ())
 	 {
@@ -286,7 +286,7 @@
 	    goto texture2_done;
 	    }
 	 // Read in the offsets for TEXTURE2 names
-	 offsets = (i32 *) GetMemory ((long) numtex * 4);
+	 offsets = (i32 *) GetMemory ((long) numtex * sizeof(i32));
 	 wf->read_i32 (offsets, numtex);
 	 if (wf->error ())
 	    {
@@ -514,7 +514,7 @@
       dir->wadfile->seek (dir->dir.start);
       dir->wadfile->read_i32 (&numtex);
       // Read in the offsets for texture1 names and info
-      offsets = (i32 *) GetMemory ((long) numtex * 4);
+      offsets = (i32 *) GetMemory ((long) numtex * sizeof(i32));
       dir->wadfile->read_i32 (offsets, numtex);
       for (n = 0; n < numtex && !texofs; n++)
 	 {
@@ -534,7 +534,7 @@
 	 dir->wadfile->seek (dir->dir.start);
 	 dir->wadfile->read_i32 (&numtex);
 	 // Read in the offsets for texture2 names
-	 offsets = (i32 *) GetMemory ((long) numtex * 4);
+	 offsets = (i32 *) GetMemory ((long) numtex * sizeof(i32));
 	 dir->wadfile->read_i32 (offsets);
 	 for (n = 0; n < numtex && !texofs; n++)
 	    {
diff -Naur yadex-1.7.0/src/yadex.h yadex-1.7.0.new/src/yadex.h
--- yadex-1.7.0/src/yadex.h	2006-03-16 20:33:12.000000000 -0800
+++ yadex-1.7.0.new/src/yadex.h	2006-03-16 20:29:15.000000000 -0800
@@ -98,11 +98,11 @@
 #define F_I16_D "hd"
 #define F_I16_H "hX"
 
-typedef unsigned long  u32;
+typedef unsigned int  u32;
 #define F_U32_D "lu"
 #define F_U32_H "lX"
 
-typedef signed   long  i32;
+typedef signed   int  i32;
 #define F_I32_D "ld"
 #define F_I32_H "lX"
 
