Fixes token generation bug