add doctests and fix the discovered bugs in table_generator_from_instance_list