reorganize code about GetHeaders()