fix bugs with logout