fixed bug with token generation