fixed generation of table header/footer