Fix bugs related to saving/loading.