fix for codebook