User login and logout fixed