Fixes to codebook