Fix header detection

Take into account formatting inconsistencies.
Merge pull request #1 from M4rtinK/header_detection

Fix header detection