added test for logout and fixed bug