Fix datatype for some things in table_factory