fixed the seg fault on first reception of token