fix token generation