Fix recoding length
Merge
Add unit test for table generation