diff --git a/Graphics/gl2ps.cpp b/Graphics/gl2ps.cpp
index 4dbfc499722aa05faf3c4299b70115a999812682..64b115f9c9b3c9278027d68dae3fad45abd6b2bd 100644
--- a/Graphics/gl2ps.cpp
+++ b/Graphics/gl2ps.cpp
@@ -1,4 +1,4 @@
-/* $Id: gl2ps.cpp,v 1.105 2006-07-24 14:05:50 geuzaine Exp $ */
+/* $Id: gl2ps.cpp,v 1.106 2006-07-25 11:10:10 geuzaine Exp $ */
 /*
  * GL2PS, an OpenGL to PostScript Printing Library
  * Copyright (C) 1999-2006 Christophe Geuzaine <geuz@geuz.org>
@@ -655,19 +655,22 @@ static void gl2psListEncodeBase64(GL2PSlist *list)
   int i, n, index, len;
 
   n = list->n * list->size;
-  buffer = (unsigned char*)gl2psMalloc(n * sizeof(unsigned int));
-  memcpy(buffer, list->array, n * sizeof(unsigned int));
+  buffer = (unsigned char*)gl2psMalloc(n * sizeof(unsigned char));
+  memcpy(buffer, list->array, n * sizeof(unsigned char));
   gl2psListReset(list);
 
   index = 0;
   while(index < n) {
     len = 0;
     for(i = 0; i < 3; i++) {
-      in[i] = buffer[index++];
-      if(index < n)
+      if(index < n){
+	in[i] = buffer[index];
         len++;
-      else
+      }
+      else{
         in[i] = 0;
+      }
+      index++;
     }
     if(len) {
       gl2psEncodeBase64Block(in, out, len);
@@ -4982,8 +4985,6 @@ static void gl2psPrintSVGPixmap(GLfloat x, GLfloat y, GL2PSimage *pixmap)
   png = gl2psListCreate(pixmap->width * pixmap->height * 3, 1000, 
                         sizeof(unsigned char));
   gl2psConvertPixmapToPNG(pixmap, png);
-  c = '\0'; /* need to base64-encode a null-terminated string */
-  gl2psListAdd(png, &c); 
   gl2psListEncodeBase64(png);
   gl2psPrintf("<image x=\"%g\" y=\"%g\" width=\"%d\" height=\"%d\"\n",
               x, y - pixmap->height, pixmap->width, pixmap->height);
diff --git a/Graphics/gl2ps.h b/Graphics/gl2ps.h
index fd503a00820d22df2c3a08b0894a639b11a26608..0923c59d88dac1751a975a0e09c7282b3dca6d0a 100644
--- a/Graphics/gl2ps.h
+++ b/Graphics/gl2ps.h
@@ -1,4 +1,4 @@
-/* $Id: gl2ps.h,v 1.65 2006-07-24 14:05:50 geuzaine Exp $ */
+/* $Id: gl2ps.h,v 1.66 2006-07-25 11:10:10 geuzaine Exp $ */
 /*
  * GL2PS, an OpenGL to PostScript Printing Library
  * Copyright (C) 1999-2006 Christophe Geuzaine <geuz@geuz.org>
@@ -64,7 +64,8 @@
 #  include <GL/gl.h>
 #endif
 
-/* Support for compressed PostScript/PDF and for embedded PNG images in SVG */
+/* Support for compressed PostScript/PDF/SVG and for embedded PNG
+   images in SVG */
 
 #if defined(HAVE_ZLIB) || defined(HAVE_LIBZ)
 #  define GL2PS_HAVE_ZLIB