fixed dither function