Added check for no user id in history