Fix token factory to handle numbers