fixing JS crash when table has no content