fix test case test_to_dict in test_instances