fix crash when palette width is too small