Fixed bugs with unified table mode, and added tests for it.