fix warning and misnamed var in format_terms_to_send