When a header is corrupt, it can still be possible to use a header of a different photo file instead of the original header, provided the JPG files are technical similar.
A photo file achieves its best compression results only if its header is adjusted specially for the image, but the majority of digital cameras do not optimize the header.