minor fixes in dithering code