working gif optimization

replace the gif optimization with a working version

fixes #211