changed checking in get next token