fix saving and loading

got broken by the refactoring