optimization on logout