clean up Table initialization; fix some bugs