better logout handling