Added condition to check if table is set