Bugfixes and improvements to tableize.pl