Fix a bug caused by freeing memory too soon in the table code.