check if $tables is an array

fixes #9737 

@PVince81 @karlitschek