diff --git a/src/gui/image/qbmphandler.cpp b/src/gui/image/qbmphandler.cpp
index 7a491d8..ce86dcc 100644
--- a/src/gui/image/qbmphandler.cpp
+++ b/src/gui/image/qbmphandler.cpp
@@ -38,6 +38,7 @@
 #include <qimage.h>
 #include <qvariant.h>
 #include <qvector.h>
+#include <qdebug.h>
 
 QT_BEGIN_NAMESPACE
 
@@ -299,6 +300,7 @@ static bool read_dib_body(QDataStream &s, const BMP_INFOHDR &bi, int offset, int
     image.setDotsPerMeterX(bi.biXPelsPerMeter);
     image.setDotsPerMeterY(bi.biYPelsPerMeter);
 
+    qDebug() << __FUNCTION__ << comp;
     if (!d->isSequential())
         d->seek(startpos + BMP_FILEHDR_SIZE + (bi.biSize >= BMP_WIN4? BMP_WIN : bi.biSize)); // goto start of colormap
 
@@ -604,6 +606,7 @@ bool qt_write_dib(QDataStream &s, QImage image)
     bi.biHeight               = image.height();
     bi.biPlanes               = 1;
     bi.biBitCount      = nbits;
+    qDebug() << __FUNCTION__ << image;
     bi.biCompression   = BMP_RGB;
     bi.biSizeImage     = bpl_bmp*image.height();
     bi.biXPelsPerMeter = image.dotsPerMeterX() ? image.dotsPerMeterX()
@@ -784,12 +787,15 @@ bool QBmpHandler::read(QImage *image)
 
 bool QBmpHandler::write(const QImage &img)
 {
+    qDebug() << __FUNCTION__ << img <<"m_format=" << m_format;
     if (m_format == DibFormat) {
         QDataStream dibStream(device());
         dibStream.setByteOrder(QDataStream::LittleEndian); // Intel byte order
+        qDebug() << __FUNCTION__ << "calling qt_write_dib";
         return qt_write_dib(dibStream, img);
     }
 
+    qDebug() << __FUNCTION__ << "!= DibFormat, continuing";
     QImage image;
     switch (img.format()) {
     case QImage::Format_Mono:
@@ -840,6 +846,7 @@ bool QBmpHandler::write(const QImage &img)
     s << bf;
 
     // write image
+    qDebug() << __FUNCTION__ << "calling qt_write_dib";
     return qt_write_dib(s, image);
 }
 
diff --git a/src/gui/kernel/qdnd.cpp b/src/gui/kernel/qdnd.cpp
index 3ce8ab9..076be83 100644
--- a/src/gui/kernel/qdnd.cpp
+++ b/src/gui/kernel/qdnd.cpp
@@ -300,6 +300,7 @@ bool QInternalMimeData::hasFormatHelper(const QString &mimeType, const QMimeData
 
 QByteArray QInternalMimeData::renderDataHelper(const QString &mimeType, const QMimeData *data)
 {
+    qDebug() << __FUNCTION__ << mimeType << data;
     QByteArray ba;
     if (mimeType == QLatin1String("application/x-color")) {
         /* QMimeData can only provide colors as QColor or the name
@@ -333,7 +334,9 @@ QByteArray QInternalMimeData::renderDataHelper(const QString &mimeType, const QM
                 QImage image = qvariant_cast<QImage>(data->imageData());
                 QBuffer buf(&ba);
                 buf.open(QBuffer::WriteOnly);
-                image.save(&buf, mimeType.mid(mimeType.indexOf(QLatin1Char('/')) + 1).toLatin1().toUpper());
+                const QByteArray f =  mimeType.mid(mimeType.indexOf(QLatin1Char('/')) + 1).toLatin1().toUpper();
+                qDebug() << __FUNCTION__ << "calling QImage::save" << f;
+                image.save(&buf, f);
             }
         }
     }
diff --git a/src/plugins/platforms/windows/qwindowsmime.cpp b/src/plugins/platforms/windows/qwindowsmime.cpp
index 13260ed..56f53a3 100644
--- a/src/plugins/platforms/windows/qwindowsmime.cpp
+++ b/src/plugins/platforms/windows/qwindowsmime.cpp
@@ -1,4 +1,4 @@
-/****************************************************************************
+ /****************************************************************************
 **
 ** Copyright (C) 2015 The Qt Company Ltd.
 ** Contact: http://www.qt.io/licensing/
@@ -120,6 +120,7 @@ static inline QImage readDib(QByteArray data)
 
 static QByteArray writeDib(const QImage &img)
 {
+    qDebug() << __FUNCTION__ << img;
     QByteArray ba;
     QBuffer buffer(&ba);
     buffer.open(QIODevice::ReadWrite);
@@ -135,6 +136,7 @@ static QByteArray writeDib(const QImage &img)
 
 static bool qt_write_dibv5(QDataStream &s, QImage image)
 {
+    qDebug() << __FUNCTION__ << image;
     QIODevice* d = s.device();
     if (!d->isWritable())
         return false;
@@ -1019,8 +1021,10 @@ QString QWindowsMimeImage::mimeForFormat(const FORMATETC &formatetc) const
 bool QWindowsMimeImage::canConvertToMime(const QString &mimeType, IDataObject *pDataObj) const
 {
     if (mimeType == QLatin1String("application/x-qt-image") &&
-        (canGetData(CF_DIB, pDataObj) || canGetData(CF_PNG, pDataObj)))
+        (canGetData(CF_DIB, pDataObj) || canGetData(CF_PNG, pDataObj))) {
+        qDebug() << __FUNCTION__ << "true" ;
         return true;
+    }
     return false;
 }
 
@@ -1034,26 +1038,33 @@ bool QWindowsMimeImage::canConvertFromMime(const FORMATETC &formatetc, const QMi
         return false;
     // QTBUG-11463, deny CF_DIB support for images with alpha to prevent loss of
     // transparency in conversion.
-    return cf == CF_DIBV5 || (cf == CF_DIB && !image.hasAlphaChannel());
+    bool rc = (cf == CF_DIB && !image.hasAlphaChannel());
+    qDebug() << __FUNCTION__ << "cf=" << cf  << rc << "for " << mimeData;
+    return rc;
+
 }
 
 bool QWindowsMimeImage::convertFromMime(const FORMATETC &formatetc, const QMimeData *mimeData, STGMEDIUM * pmedium) const
 {
     int cf = getCf(formatetc);
+    qDebug() << __FUNCTION__ << cf;
     if ((cf == CF_DIB || cf == CF_DIBV5) && mimeData->hasImage()) {
         QImage img = qvariant_cast<QImage>(mimeData->imageData());
         if (img.isNull())
             return false;
         QByteArray ba;
         if (cf == CF_DIB) {
+            qDebug() << __FUNCTION__ << "CF_DIB";
             if (img.format() > QImage::Format_ARGB32)
                 img = img.convertToFormat(QImage::Format_RGB32);
             const QByteArray ba = writeDib(img);
             if (!ba.isEmpty())
                 return setData(ba, pmedium);
         } else {
+            qDebug() << __FUNCTION__ << "CF_DIB5";
             QDataStream s(&ba, QIODevice::WriteOnly);
             s.setByteOrder(QDataStream::LittleEndian);// Intel byte order ####
+            qDebug() << __FUNCTION__ << "calling qt_write_dibv5";
             if (qt_write_dibv5(s, img))
                 return setData(ba, pmedium);
         }
@@ -1293,11 +1304,19 @@ QLastResortMimes::QLastResortMimes()
 
 bool QLastResortMimes::canConvertFromMime(const FORMATETC &formatetc, const QMimeData *mimeData) const
 {
+
     // really check
 #ifndef QT_NO_DRAGANDDROP
-    return formatetc.tymed & TYMED_HGLOBAL
+    bool rc = formatetc.tymed & TYMED_HGLOBAL
         && (formats.contains(formatetc.cfFormat)
         && QInternalMimeData::hasFormatHelper(formats.value(formatetc.cfFormat), mimeData));
+    if (qEnvironmentVariableIsSet("NOLASTRESORT"))
+        rc = false;
+    qDebug() << __FUNCTION__
+             << "cf=" << formatetc.cfFormat
+             << formats.value(formatetc.cfFormat)
+             << rc;
+     return rc;
 #else
     Q_UNUSED(mimeData);
     Q_UNUSED(formatetc);
@@ -1308,9 +1327,13 @@ bool QLastResortMimes::canConvertFromMime(const FORMATETC &formatetc, const QMim
 
 bool QLastResortMimes::convertFromMime(const FORMATETC &formatetc, const QMimeData *mimeData, STGMEDIUM * pmedium) const
 {
+
 #ifndef QT_NO_DRAGANDDROP
-    return canConvertFromMime(formatetc, mimeData)
+    qDebug() << __FUNCTION__ << ">cf=" << formatetc.cfFormat;
+    bool rc = canConvertFromMime(formatetc, mimeData)
         && setData(QInternalMimeData::renderDataHelper(formats.value(getCf(formatetc)), mimeData), pmedium);
+    qDebug() << __FUNCTION__ << rc;
+    return rc;
 #else
     Q_UNUSED(mimeData);
     Q_UNUSED(formatetc);
