tables refactor fix