Fixed bug in byte order swapping of image data, which corrupted data
under a specific set of circumstances.