Fixed bugs in the manipulation of the token pointer.