Fixed the tbl writer