fixed the table generation