fixed a bug in table gen