Fixed transparency issue in merged layer of PSD writer.
diff --git a/coders/psd.c b/coders/psd.c
index 603fe09..6a56d1f 100644
--- a/coders/psd.c
+++ b/coders/psd.c
@@ -2671,7 +2671,7 @@
       else
         rounded_layer_info_size=layer_info_size;
       (void) SetPSDSize(&psd_info,image,rounded_layer_info_size);
-      if (base_image->alpha_trait != UndefinedPixelTrait)
+      if (image->alpha_trait != UndefinedPixelTrait)
         (void) WriteBlobMSBShort(image,-(unsigned short) layer_count);
       else
         (void) WriteBlobMSBShort(image,(unsigned short) layer_count);