Fix palette encoder