log in and log out working better