fixed bug
working on the functions for generating tables