Fixing the header-name definition and handling invalid UTF-8 

fixes #231 and #232