add automatic header size check