fix function scopes
Merge branch 'csv_import_for_air'