fixed extract_headers