Fixing the logic for guarding the user search.