fixing table_factory issues