added fix for nil record in assemble_pairs