fixed bugs in readTable