Added logout handling when session expires.