algorithm of table computation changed
fixed calculation of table