Better logout handling