Fix logout behavior.

Change-Id: I9afaebe5c1385c6894624db316741668dd8c9ead