fix bugs and enable log out