Added check for j===undefined in case token is missing