This fixes an issue with animated GIFs not being created properly

I found this while playing around. Hope it helps.
Michael