Fix error when user is not logged in