fixed bugs in plotting and table functions