fix logout crash bug