Merged pull request #143 from nordsturm/fix_loop. Fix going into infinite loop in read_header_loose()