Fix the ncolors of palette not initialized issue.