Fixed bug if table is empty