Fixed logout code bug