fixed a couple of bugs in saving and loading