Fix some problems with saving and loading