Fix save on logout bug