fixing codebook