fix to use the table_name set in the model with set_table_name