improved save system so that the current state is also cleared