Fix cmap handling