Fixed completely broken class ExportCodebook, added tests. Fixes #197.