add termsize, delete some useless code