avoid calling extract_record multiple times