fix gif test, fix gif optimization for palette length < 3