--- Imlib/load.c.orig	Fri Mar 22 14:43:04 2002
+++ Imlib/load.c	Wed Jun 18 15:49:01 2003
@@ -254,7 +254,8 @@ _LoadPNG(ImlibData * id, FILE * f, int *
   png_read_image(png_ptr, lines);
   png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
   ptr = data;
-  if (color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
+  if (color_type == PNG_COLOR_TYPE_GRAY
+      || color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
     {
       for (y = 0; y < *h; y++)
 	{
@@ -279,6 +280,7 @@ _LoadPNG(ImlibData * id, FILE * f, int *
 	    }
 	}
     }
+#if 0
   else if (color_type == PNG_COLOR_TYPE_GRAY)
     {
       for (y = 0; y < *h; y++)
@@ -294,6 +296,7 @@ _LoadPNG(ImlibData * id, FILE * f, int *
 	    }
 	}
     }
+#endif
   else
     {
       for (y = 0; y < *h; y++)
@@ -645,9 +648,9 @@ _LoadBMP(ImlibData * id, FILE *file, int
   planes = (int)word;
   fread(&word, 2, 1, file);
   bpp = (int)word;
-  if (bpp != 1 && bpp != 4 && bpp != 8 && bpp && 16 && bpp != 24 && bpp != 32)
+  if (bpp != 1 && bpp != 4 && bpp != 8 && bpp != 16 && bpp != 24 && bpp != 32)
     {
-      fprintf(stderr, "IMLIB ERROR: unknown bitdepth in file\n");
+      fprintf(stderr, "IMLIB ERROR: unknown bitdepth %d in file\n", bpp);
       return NULL;
     }
   fread(dbuf, 4, 4, file);
@@ -1061,7 +1064,7 @@ _LoadXPM(ImlibData * id, FILE *file, int
 			  if (line[k] != ' ')
 			    {
 			      s[0] = 0;
-			      sscanf(&line[k], "%256s", s);
+			      sscanf(&line[k], "%255s", s);
 			      slen = strlen(s);
 			      k += slen;
 			      if (!strcmp(s, "c"))
@@ -1861,7 +1864,7 @@ Imlib_load_image(ImlibData * id, char *f
 	  free(im);
 	  return NULL;
 	}
-      sscanf(s, "%256s %i", s1, &num);
+      sscanf(s, "%255s %i", s1, &num);
       if (num <= 0)
 	{
 	  fclose(p);
@@ -1870,10 +1873,10 @@ Imlib_load_image(ImlibData * id, char *f
 	}
       while (fgets(s, 4096, p))
 	{
-	  sscanf(s, "%256s", s1);
+	  sscanf(s, "%255s", s1);
 	  if (!strcmp("IMAGE", s1))
 	    {
-	      sscanf(s, "%256s %i %256s %i %i %i %i %i %i %i %i %i", s1, &size,
+	      sscanf(s, "%255s %i %255s %i %i %i %i %i %i %i %i %i", s1, &size,
 		     s2, &w, &h, &r, &g, &b, &bl, &br, &bt, &bb);
 	      if (!iden[0])
 		break;
