Fixed logout logic.