fixed it to work on terminals with over 48 lines, and fixed bug