Fixed header parsing. Previous version is obviously not working.