Various fixes for MacOSX 10.8 + JPEG seek_subimage

Various fixes for MacOSX 10.8 + JPEG seek_subimage