Merge cristy's fixes from ImageMagick-6 branch