added logic so doesn't freak out if user is not logged in