Fix for read-image and write-image