Avoid KeyError when uid > max_uid_logged_in