fixed some edge cases in TableTrait