Fixed two bugs that prevented the dimensions from being properly read from certain JPEG images. Also cleaned up the endian swapper.