fixed errors in get_tables_data function