Fixed load and save function so that they work, although the load function does not handle errors correctly