Revised the else logic to convert the tableName to a string for use as a dictionary key