Added check to limit the length of a received token.