alpha channel bugfixes in applyPalette