Fixed logout loop