fixed a bug where tables with no data throw an error