diff --git a/app/contacts/contact_import.php b/app/contacts/contact_import.php
index 911033d448..5e5ef5a715 100644
--- a/app/contacts/contact_import.php
+++ b/app/contacts/contact_import.php
@@ -318,6 +318,9 @@
//echo "table_name: $table_name
\n";
//echo "field_name: $field_name
\n";
+ //get the parent table name
+ $parent = get_parent($schema, $table_name);
+
//add fields to the stack
if (isset($field_count[$table_name][$field_name])) {
$field_count[$table_name][$field_name]++;
@@ -329,9 +332,6 @@
//set the ordinal ID
$id = $field_count[$table_name][$field_name];
- //get the parent table name
- $parent = get_parent($schema, $table_name);
-
//remove formatting from the phone number
if ($field_name == "phone_number") {
$result[$key] = preg_replace('{(?!^\+)[\D]}', '', $result[$key]);