Fixing bug randomly appearing in GIF reading