Add function: save_table. Fix some  errors.