Some bugfixes in code book