Fixed logout code