diff --git a/lib/modules/Protocols.pmod/X.pmod/Types.pmod b/lib/modules/Protocols.pmod/X.pmod/Types.pmod
index 8c26d219b5ec203302ab8e2a28d08c929233ca71..41f5fa2df4e78a5f0a999ceea66437a812703c6c 100644
--- a/lib/modules/Protocols.pmod/X.pmod/Types.pmod
+++ b/lib/modules/Protocols.pmod/X.pmod/Types.pmod
@@ -21,8 +21,11 @@ class XResource
   void Free()
   {
     object req = this_object()->FreeRequest();
-    req->id = id;
-    display->send_request( req );
+    if (req)
+      {
+	req->id = id;
+	display->send_request( req );
+      }
   }
 
   void destroy()
@@ -246,6 +249,8 @@ class Colormap
   }
 }
 
+/* Kludge */
+#define PIXMAP (_Types.get_pixmap_class())
 
 class Drawable
 {
@@ -306,7 +311,7 @@ class Drawable
   {
     object req = CreatePixmap_req(width, height, depth);
     display->send_request( req );
-    object p = Pixmap(display, req->pid, this_object(), colormap );
+    object p = PIXMAP(display, req->pid, this_object(), colormap );
     p->depth = depth;
     return p;
   }
@@ -441,7 +446,7 @@ class Window
   inherit Drawable;
   int currentInputMask;
 
-  function FreeRequest = lambda(){}; // FIXME!!
+  function FreeRequest = lambda(){ return 0; }; // FIXME!!
 
   /* Keys are event names, values are arrays of ({ priority, function }) */
   mapping(string:array(array)) event_callbacks = ([ ]);
@@ -653,7 +658,7 @@ class Window
     w->depth = d||depth||this_object()->rootDepth;
     w->colormap = c;
     w->currentInputMask = req->attributes->EventMask;
-    w->attributes = attributes;
+    w->attributes = attributes || ([]);
     return w;
   }
     
@@ -979,4 +984,8 @@ class RootWindow
   }
 }
 
-
+/* Kludge */
+void create()
+{
+  _Types.set_pixmap_class(Pixmap);
+}
diff --git a/lib/modules/Protocols.pmod/X.pmod/_Types.pmod b/lib/modules/Protocols.pmod/X.pmod/_Types.pmod
new file mode 100644
index 0000000000000000000000000000000000000000..406a4dd4c6defdd5883c9eed27d85d10d2621fd2
--- /dev/null
+++ b/lib/modules/Protocols.pmod/X.pmod/_Types.pmod
@@ -0,0 +1,9 @@
+/* _Types.pmod
+ *
+ * Kludge for pike-0.5 */
+
+program pixmap_class;
+
+program get_pixmap_class() { return pixmap_class; }
+
+void set_pixmap_class(program p) { pixmap_class = p; }