sniff header version + fix logical bug