Fix token cursor generation