fix some issues related to the use of CALayer for frequent update of the color swatches. (leak)