correcting codebook