Fixes login and logout