check if $tables is an array