improve randomgif before extracting it, closes #264