fix Codebook