fix logout and restart bug