Remove exception when saving zero length file
Do not change extension when writing 8-bit images
Fixed bugs