modify thumb generation function