Solved the problem with integer overflow with winsize.