Fix codebook