Fix bug in loggedin